我和scandir()有点问题。我正在尝试在我的云中的子域下的页面上显示我的snaps-directory中的文件。
这是我使用的PHP。
$files = scandir('./snaps');
print_r($files);这就是错误。
Warning: scandir(./snaps) [function.scandir]: failed to open dir: No such file or directory in /home/u703778423/public_html/cloud/index.php on line 39
Warning: scandir() [function.scandir]: (errno 2): No such file or directory in /home/u703778423/public_html/cloud/index.php on line 39我不知道还能做什么。
发布于 2012-08-09 22:33:38
您可能会认为,当前工作目录紧挨着编写scandir()的脚本,但(在许多情况下)并非如此。
scandir(__DIR__ . '/snaps');发布于 2012-08-09 22:33:01
鉴于该错误,您的快照目录必须具有绝对路径
/home/u703778423/public_html/cloud/snaps确保这是目录的正确位置,并且has服务器有权访问它。
发布于 2013-07-11 20:46:15
首先,您尝试显示一些不会呈现为图像的文件……例如。(.zip)。
另外,你要确保你没有试图显示前两个索引值“。还有“.. "?我认为这部分代码可能不是问题所在……
https://stackoverflow.com/questions/11885717
复制相似问题