[英]Is the array returned by scandir() a countable object?
我试图弄清楚为什么count(scandir("/dirname"));
当目录中的文件数不为0时,始终为0。当有人进入我的页面时,以下脚本在页面顶部执行:
<?php
setcookie("user", count(scandir("/players")));
?>
该目录包含2个文件。 但是count(scandir("/dirname"));
仍然为0。是因为数组
player0.json
player1.json
scandir()
返回的是不可数的对象?
您对该文件夹没有Read/Write Permission
,或者您Trying to access the directory which isn't in the Root Scope
。 我建议您提供“ / players directory”的Relative Path
,而不是“ Absolute Path
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.