【发布时间】:2017-05-27 12:20:48
【问题描述】:
我得到:
文件名、目录名或卷标语法不正确。 (代码:123)
我有以下功能:
public static function countDirectoryFiles($dir){
$i = 0;
if ( $handle = opendir($dir) )
{
while ( ($file = readdir($handle)) !== false )
{
if (!in_array($file, array('.', '..')) && !is_dir($dir.$file))
$i++;
}
}
// prints out how many were in the directory
return $i;
}
opendir 函数出现错误,提示:
opendir(D:\wamp\www\abc\public/frontend/images/ 相册/temp_storage_for_gallery/user_1/thumbnail/,D:\wamp\www\abc\public/frontend/images/ 相册/temp_storage_for_gallery/user_1/thumbnail/)
而 D:\wamp\www\gillie\public/frontend/images/ albums/temp_storage_for_gallery/user_1/thumbnail/ 存在,我在 Windows 资源管理器中检查了几次。
我正在使用与此错误无关的 laravel 5.2,使用 windows7。
我突然开始收到此错误,因为过去 3-4 个月相同的代码运行良好。
我在互联网上搜索过这个,但没有任何帮助。
更新 当我直接在代码下面运行时:
print(opendir('D:\wamp\www\abc\public\frontend\images\albums\temp_storage_for_gallery\user_1\thumbnail'));
我明白了:
Resource id #469
任何指导将不胜感激!
【问题讨论】: