|
 |
|
รบกวนหน่อยค่ะ พอดีตอนนี้เขียนโปรแกรมตัดข้อความได้แล้วนะคะ แต่ได้ทีละไฟล์ ต้องการที่จะให้ตัดไฟล์ที่อยู่ในโฟลเดอร์ทั้งหมด |
|
 |
|
|
 |
 |
|
Code (PHP)
<?php
header("Content-type: text/html; charset=utf-8");
$dir = "ตรงนี้ใส่ไดเรคทอรี่ที่ต้องการอ่านไฟล์ข้างใน เช่น /test/ อย่าลืม / ด้วยนะครับ";
// Open a known directory, and proceed to read its contents
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
$handle = @fopen($file, "r");
$x=0;
if ($handle) {
while (($buffer = fgets($handle, 4096)) !== false) {
if (ereg('เรียบเรียง',$buffer)){
$x=1;
continue;
}
if ($x==1){
echo $buffer;
}
}
fclose($handle);
}
}
closedir($dh);
}
}
?>
|
 |
 |
 |
 |
Date :
2010-11-02 17:41:27 |
By :
adaaugusta |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 02
|