我想检查我的服务器上的文件夹中是否有任何图像.我在PHP中有这个小功能,但是不工作,我不知道为什么:
$path = 'folder/'.$id;
function check($path) {
if ($handle = opendir($path)) {
$array = array();
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." && count > 2) {
echo "folder not empty";
} else {
echo "folder empty";
}
}
}
closedir($handle);
}
Run Code Online (Sandbox Code Playgroud)
任何帮助将不胜感激,提前感谢.
php ×1