Home  >  Article  >  Backend Development  >  php小白,php关于directory类的异常 Undefined property: Directory:$uu

php小白,php关于directory类的异常 Undefined property: Directory:$uu

WBOY
WBOYOriginal
2016-06-13 13:11:39982browse

php小白求救,php关于directory类的错误 Undefined property: Directory::$uu
本人php新手,学电子的想学点网页编程转行做电子商务网站开发。今年大四很迷茫呀,现在兼职开淘宝赚个三四百一个月。好了,转入正题。
  代码如下,我是照书本写的,想测试一下加深理解,但是出错了
$path="uu";//是WWW目录下的一个文件夹,我是创建了的
$d=dir($path);
while(false!==($v=$d->read()))
{
if($v=="."||$v=="..")
{
continue;
}
$file=$d->$path."\\".$v;
if(is_dir($file))
{
continue;
}
if(is_file($file))
{
echo $v."";
}
}
$d->close();
?> 


运行之后浏览器显示错误提示:Notice: Undefined property: Directory::$uu in L:\wamp\www\dynamic.php on line 20
各位前辈指点一下小生,呵呵。谢谢啦

------解决方案--------------------
$file=$d->$path."\\".$v;
改为
$file = $d->path."/".$v;
------解决方案--------------------
$file=$d->$path."\\".$v;
请把这一行改为
$file=$d->path."\\".$v;

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn