我有一个代码来检查目录是否为空,以便我能够执行操作,但是这个简单的代码给出了一个错误:
警告: opendir(/Site/images/countries/abc/a/2.swf,/Site/images/countries/abc/a/2.swf) [function.opendir]: 系统找不到指定的路径。(代码:3)在 C:\wamp\www\Site\index.PHP 第 374 行
没有这样的文件
function IsNotEmpty($folder){
$files = array ();
if ( $handle = opendir ( $folder ) )
{
while ( false !== ( $file = readdir ( $handle ) ) )
{
if ( $file != "." && $file != ".." )
{
$files [] = $file;
}
}
closedir ( $handle );
}
return ( count ( $files ) > 0 ) ? TRUE: FALSE; }
$dir ="/Site/images/countries/abc/a/2.swf";
if (IsNotEmpty($dir)==true)
{
echo "There is no such file";
}
else
{
echo "The file exists!";
};
我不明白这里有什么问题。文件退出指定目录。