Here is my php code:
Code: Select all
<?php
$filename = "filelist.txt";
$filelist = fopen( $filename, "r") or die("Cannot open $filename for reading.");
while (!feof($filelist))
{
$fte = fgets($filelist, 1024);
$file = fopen($fte, "r") or die("Cannot open $file for reading and editing.");
while(!feof($file))
{
$lte = fgets($file, 1024);
$newFile = fopen("newFiles/$fte", "a");
fwrite($newFile, ereg_replace("layout.css","style.css",$lte));
}
print "File $fte has been created and edited!";
}
print "<h1>Done!</h1>";
?>Warning: fopen(apply.html ) [function.fopen]: failed to create stream: Invalid argument in C:\Program Files\Apache Group\Apache2\mc0\fileedit.php on line 8
Cannot open for reading and editing.
Now this code works but only if there is one filename inside "filelist.txt".