Include all files in a dir.

General discussions related to php

Moderators: egami, macek, gesf


Sun Oct 06, 2002 9:49 am

Look up the file system functions. Learn how to read a directly for all the files, open the file, read it and print it, and then close each file in turn!


Sun Oct 06, 2002 10:15 am

Errm, I think you're confused about classes!

Try something like this:

Code: Select all

$dir = "./";
while($file = each($dir)) {
if (substr($file,-4) == "html") print "<hr>\n".htmlspecialchars(file($file));

I just made that up, you might have to play with it a bit to get it to work!


Sun Oct 06, 2002 10:41 am

Ok, my mistake, but if you knew the code, why did you bother asking?

As it's been sorted, I'll close this thread