|
Posted by Foofy on 03/03/05 13:53
I'm writing a script that transfers files from a list file and saves the=
m =
locally. M
If I use values from the list for the filenames of the saved files, it =
appears that none of the files are saved 'cept for the last one. If I pu=
t =
the values in an array directly in the script file, all is well. I have =
=
confirmed that the values are different and I've tried other methods to =
=
load the file, such as fgets. Here is a simplified version of my script =
=
that has the same problem:
<?php
$linklist =3D file('links.txt');
foreach ($linklist as $link) {
echo "saving to $link<br>"; // confirm link name
$file =3D fopen ($link, 'w'); // write dummy text to file
fwrite($file, 'blah');
fclose($file);
}
?>
And in links.txt I have:
link one
link two
link three
If I run the script, the only file that will have been created is "link =
=
three" or whatever is on the bottom. If however, I replace the first lin=
e =
with:
=
$linklist =3D array("link one", "link two", "link three");
Then the script works as expected. What am I missing? I've wasted three =
=
hours trying to figure this out and I don't know what I could be screwin=
g =
up. :(
Foofy
-- =
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Navigation:
[Reply to this message]
|