Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Reading files into PHP

0 views
Skip to first unread message

Marco J.L

unread,
Apr 6, 2005, 4:44:07 PM4/6/05
to
Hello,

how can I read files into PHP. I can make a listing of a directory, but
reading the file content into the PHP goes wrong.

==== script ==========
<?php
$handle=opendir('nieuws');
while (false!==($file = readdir($handle))) {
if ($file != "." && $file != "..") {
$fp = fopen($file,"rb");
fpassthru($fp);
fclose($fp);
echo $fp;
echo "<HR>";
}
}
closedir($handle);
?>

===========

Thanx,

Marco J.L.


NC

unread,
Apr 6, 2005, 5:04:35 PM4/6/05
to
Marco J.L wrote:
>
> how can I read files into PHP. I can make a listing of a directory,
> but reading the file content into the PHP goes wrong.

Try this:

$handle = opendir('nieuws');


while (false!==($file = readdir($handle))) {
if ($file != "." && $file != "..") {

readfile($file);
echo "<HR>";
}
}
closedir($handle);

Cheers,
NC

Chung Leong

unread,
Apr 7, 2005, 7:27:23 PM4/7/05
to

"Marco J.L" <luye...@yahoo.com.news> wrote in message
news:d31i23$pu$1...@reader10.wxs.nl...

array_map('readfile', glob('nieuws/*.*'));


0 new messages