作者: Butt 時間: 2008-12-31 08:42 標題: Simple Php problem about scandir
Hi, everyone.
I got a problem in php as i don't really know too much php.
My situation is:
My pictures in> "/site/pic/" e.g. "/site/pic/a.jpg"
My php programs in >"/site/phpfile" e.g. "/site/phpfile/testing.php"
OK, now i want to use testing.php to list the files name from /site/pic/ e.g. a.jpg, b.jpg
My code is:
$dir = "/site/pic"
$pics = scandir($dir);
but the scandir doesn't work. How can i scandir the folder when it is upper folder?
Thank you
作者: Butt 時間: 2008-12-31 08:43
If i put php and image in the same folder, it will work.
$dir = "."
$pics = scandir($dir);
So i am wondering...how can i do the structure like that.
[ 本帖最後由 Butt 於 2008-12-31 08:46 編輯 ]
作者: little_keung 時間: 2008-12-31 09:23
原帖由 Butt 於 2008-12-31 08:43 發表
If i put php and image in the same folder, it will work.
$dir = "."
$pics = scandir($dir);
So i am wondering...how can i do the structure like that.
I guess it is the problem of web server or php setting.
It may do something on security.
作者: tunster 時間: 2008-12-31 09:43
try "../pic/"
作者: Butt 時間: 2008-12-31 13:00
../ does work.

