我遇到了麻烦scandir().我正在尝试snaps在我的云中的子域下的页面上显示我的目录中的文件.
这是我用过的PHP.
$files = scandir('./snaps');
print_r($files);
Run Code Online (Sandbox Code Playgroud)
这是错误.
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
Run Code Online (Sandbox Code Playgroud)
我不知道还能做什么.
Kin*_*nch 10
您可能认为,当前工作目录是scandir()写入脚本的旁边,(在许多情况下)不是.
scandir(__DIR__ . '/snaps');
Run Code Online (Sandbox Code Playgroud)
鉴于该错误,您的 snaps 目录必须具有以下绝对路径
/home/u703778423/public_html/cloud/snaps
Run Code Online (Sandbox Code Playgroud)
确保这是目录的正确位置,并且网络服务器有权访问它。
| 归档时间: |
|
| 查看次数: |
14314 次 |
| 最近记录: |