This script read the filenames from a specified directory and returns them in an array.

Function searchdir($basedir)
global $filelisting, $number; //defines the two variables as global so they can be accessed
unset($filelisting); //kills $filelisting in case it have been used earlier in the
unset($number); //same as above
while ($file = readdir($handle)) {
if ($file==”.” or $file==”..”) {
} else {
$number=sizeof($filelisting); //取得文件個數
searchdir(“.”); //runs the function to search the current directory
echo $filelisting[1]; //echos the second value in the array
echo $number; //echos the size of the array


發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *