You are here: Re: [PHP] array from folder « PHP « IT news, forums, messages
Re: [PHP] array from folder

Posted by Kim Briggs on 10/09/32 11:14

I have a sloppy, insecure script that does this posted on the web,
which I use at home to make pages for my personal homepage:
http://kimbriggs.com/computers/computer-software/create-html-table.txt

You seem to be passing variables programmatically. This is how I use it
http://kimbriggs.com/computers/computer-software/create-html-table.html

cheers,
KB

On 4/25/05, Jason Barnett <jason.barnett@telesuite.com> wrote:
> Jay Blanchard wrote:
> > [snip]
> > Can PHP generate an array based on file names in a folder?
> >
> > For example, if I have a folder called "photos" that includes three
> > files -- tree.jpg, house.jpg and boat.jpg -- can PHP "look" at the file
> > and generate a variable $photos= array ("tree", "house","boat"). Any
> > ideas for how to "sniff" out a folder to determine how many files are in
> > it and then create an array with the file names in it?
> > [/snip]
> >
> > Start with http://www.php.net/readdir
>
> Yep.
>
> <?php
>
> $dp = fopen('/path/to/dir', 'r');
>
> while(false !== $files[] = readdir($dp)) {}
>
> closedir($dp);
> $str = implode('', $files);
> var_dump($str);
>
> ?>
>
>
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация