文件名、目录名或卷标语法不正确。 (代码:123)
The filename, directory name, or volume label syntax is incorrect. (code: 123)
我得到:
The filename, directory name, or volume label syntax is incorrect.
(code: 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/
albums/temp_storage_for_gallery/user_1/thumbnail/,D:\wamp\www\abc\public/frontend/images/
albums/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
如有任何指导,我们将不胜感激!
经过一段时间的调试后,我发现我已经将存储在 $dir 中的路径分解为 no。行以提高可读性和减少行的长度。因此在这个路径中误插入了一个space,所以出现了这个问题。
我得到:
The filename, directory name, or volume label syntax is incorrect. (code: 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/ albums/temp_storage_for_gallery/user_1/thumbnail/,D:\wamp\www\abc\public/frontend/images/ albums/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
如有任何指导,我们将不胜感激!
经过一段时间的调试后,我发现我已经将存储在 $dir 中的路径分解为 no。行以提高可读性和减少行的长度。因此在这个路径中误插入了一个space,所以出现了这个问题。