Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/290.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
php';s file_exists对于具有外语字符的文件名返回false $file_name=“x:/htdocs/host/sales_documents/testvilkår,webhotell og domenenavn_2ccda.pdf”; 如果(!file_存在($file_名称)) { 回声“404错误”; 出口 }_Php_File Exists - Fatal编程技术网

php';s file_exists对于具有外语字符的文件名返回false $file_name=“x:/htdocs/host/sales_documents/testvilkår,webhotell og domenenavn_2ccda.pdf”; 如果(!file_存在($file_名称)) { 回声“404错误”; 出口 }

php';s file_exists对于具有外语字符的文件名返回false $file_name=“x:/htdocs/host/sales_documents/testvilkår,webhotell og domenenavn_2ccda.pdf”; 如果(!file_存在($file_名称)) { 回声“404错误”; 出口 },php,file-exists,Php,File Exists,文件名是一个有效的文件,而且它确实存在,但是仍然文件\u exists返回false您能告诉我它背后的原因吗?检查您的文件路径。你的代码没问题 将斜杠更改为常量目录\u分隔符并将文件://添加到路径。Unix还是Windows?尝试反斜杠?尝试用{}括起文件名。找到解决方案了吗?我有一个相似的问题,有一个“,”和一个彼此相邻的空间,这困扰着我。 $file_name = "x:/htdocs/host/sales_documents/testvilkår, webhotell og domene

文件名是一个有效的文件,而且它确实存在,但是仍然
文件\u exists
返回
false

您能告诉我它背后的原因吗?

检查您的文件路径。你的代码没问题

将斜杠更改为常量
目录\u分隔符
并将
文件://
添加到路径。

Unix还是Windows?尝试反斜杠?尝试用{}括起文件名。找到解决方案了吗?我有一个相似的问题,有一个“,”和一个彼此相邻的空间,这困扰着我。
$file_name = "x:/htdocs/host/sales_documents/testvilkår, webhotell og domenenavn_2ccda.pdf";

if(!file_exists($file_name))
{   
    echo "<h2>404 Error</h2>";
    exit;
}