Re: Directory
| From: | Richard Lynch | Date: | Fri, 08 Feb 2008 18:36:08 +0000 |
| Subject: | Re: Directory | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-268963@lists.php.net to get a copy of this message | ||
On Thu, February 7, 2008 12:30 pm, Steve Marquez wrote:
> Greetings,
>
> Could someone please point me in the right direction? I am trying to
> have
> PHP find out if a directory has files in it and then if it does,
> display and
> include, if it does not, then not display the include.
>
> I have looked at the Manual and did not really know where to look.
http://php.net/opendir
http://php.net/readdir
<?php
$dir = opendir("/full/path/to/the/dir/please") or die("No such dir.");
while (($f = readdir($dir)) !== false){
echo "$f<br />";
include $f;
}
?>
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?