|
 |
|
ต้องการรับข้อมูลจากตัวแปร $elem ซึ้งตัวแปรนี้เป็นการเก็บข้อมูลที่ดึงมาจากหน้าเว็บ เข้าโปรแกรมตัดคำ swath |
|
 |
|
|
 |
 |
|
ต้องการรับข้อมูลจากตัวแปร $elem ซึ้งตัวแปรนี้เป็นการเก็บข้อมูลที่ดึงมาจากหน้าเว็บ เข้าโปรแกรมตัดคำ swath ช่วยดูโค้ดให้หน่อยนะคะ
Code (PHP)
<form method="post">
<textarea name="input_text" cols="80" rows="10"></textarea>
<input type="submit" value="submit">
</form>
<?php
function swath($input_text)
{
$input_filename= tempnam("/tmp", "swath_");
$output_filename= tempnam("/tmp", "swath_");
$input_text_tis620 = iconv("UTF-8", "TIS-620", $input_text);
file_put_contents($input_filename, $input_text_tis620);
system("C:\AppServ\www\swath < $input_filename > $output_filename");
$raw = file_get_contents($output_filename);
$raw_utf8 = iconv("TIS-620", "UTF-8", $raw);
unlink($input_filename);
unlink($output_filename);
return preg_split('/\|/', $raw_utf8);
}
if($_REQUEST['input_text']) {
$output = swath($_REQUEST['input_text']);
print implode("<BR>", $output);
file_put_contents("C:\AppServ\www\swathf\outputnews.txt",implode ($output ,"\r\n"));
}
?>
Tag : PHP

|
|
 |
 |
 |
 |
Date :
2012-05-14 01:44:13 |
By :
?????? |
View :
914 |
Reply :
2 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
file_put_contents("/swathf/outputnews.txt",implode ($output ,"\r\n"));
แค่นี้น่าจะพอหรือเปล่าครับ
|
 |
 |
 |
 |
Date :
2012-05-14 11:26:11 |
By :
mr.win |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
mr.win โค้ดข้างบนมันรับข้อมูลจาก textbox จะแก้ไขให้มันรับข้อมูล ตัวแปร $elem ยังไงคะ
|
 |
 |
 |
 |
Date :
2012-05-14 14:14:43 |
By :
Butterney |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 05
|