PHP 遍历文件 各位高手请帮我看下这个程序哪里出错了?谢谢,呵呵。

<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; 试试
第2个回答  2013-09-11
echo "</tr>;这里少一个分号,你看一下对不
第3个回答  2013-09-11
路径问题:echo "<B>目录</B>:".path;应该是$path

相关了解……

你可能感兴趣的内容

大家正在搜

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网