![]() |
|
首页 │ Apache │ Linux│ Java│ MySQL│ 注册│帮助 | |||
相关问题
代码:[/COLOR]
<?php
//列出某个目录下的所有子目录[/COLOR]
header("Content-type: text/html; charset=??????");
$path = "image[/COLOR] ";
$handle=opendir($path);
echo "目录 handle: $handle
";
echo "档案:
";
while ($file = readdir($handle)) {
//echo "$file
";
//echo "/".$file."
";
if (is_dir($file) [/COLOR] && ($file!= ".") && ($file!="..")){
echo "$file
";
}
}
closedir($handle);
?>
如果将$path赋值为"."的话,可以无误的执行;但是改成别的话,就无法正确显示出子目录名,而且原因应该出自于is_dir函数:
如果改成 if (is_dir($file) [/COLOR]),却能显示出"."和"..",很奇怪
请指教!
提问者:kakabu 08-13 17:05
答复

