PHP opendir()的路径类型


Path type for PHP opendir()

问这个问题似乎有点奇怪。opendir()需要什么路径?

当我尝试:opendir('/home/myuser/public_html');并得到这个[function.opendir]: failed to open dir: No such file or directory时。

如果这个路径不正确,应该是什么?

您使用的语法很好。(请参阅opendir上的PHP手册)

路径要么不存在,要么PHP用户无权访问它。

您应该使用相对路径。。例如:如果您的PHP应用程序位于/opt/project则应将其用作('../../home/myuser/public_html')