<table border="1">
<tr>
<th>文件</th>
</tr>
<?php
function Directory($dir)
{
$dp=opendir($dir);
while ($file=readdir($dp))
{
if($file!='.' && $file!='..')
{
$path=$dir."/".$file;
if (is_dir($path))
{
echo "<B>目录</B>:".path;
echo "<br>";
Directory($path);
}
else
{
echo "<tr>";
echo "<td>".$path."<td>";
echo "</tr>;
}
}
}
closedir($dp);
}
Directory(realpath("F:\\照片图片"));
?>
运行后的提示:
Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in E:\programmfiles\AppServ\www\007.php on line 30
要书写认真,比如你的 path 前面没加$,另外 echo "</tr>;这里没有双引号等等,自己好好检查一下吧
温馨提示:答案为网友推荐,仅供参考
第1个回答 2013-09-11
echo "<B>目录</B>:".path;
这个位置path; 改成$path; 试试
这个位置path; 改成$path; 试试
第2个回答 2013-09-11
echo "</tr>;这里少一个分号,你看一下对不
第3个回答 2013-09-11
路径问题:echo "<B>目录</B>:".path;应该是$path