使用opendir在文件夹名称中打开包含空格的文件夹(添加引号不起作用)

时间:2014-05-02 09:32:26

标签: php file-io directory

下面是我用来打开文件夹名称中有空格的文件夹的简化代码。

$path = ABSOLUTE_MEDIA_PATH."training/".$cfolder['folder']."/".$coursename."/";
$directory = opendir("$path");


while(false!==$file=readdir($directory)) {

echo $file;
}

正如您所看到的,我已将引号添加到文件夹路径,但它仍然无法正常工作。以下是我得到的错误

Warning: opendir(C:/xampp/htdocs/cdi1/media/training/profeuse/National Values and Principles of Governance/): failed to open dir: No such file or directory in C:\xampp\htdocs\cdi1\components\students\courses\showcoursedocs.php on line 12

Warning: readdir() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\cdi1\components\students\courses\showcoursedocs.php on line 16

0 个答案:

没有答案