2017-03-23 203 views
0

我无法访问我的服务器中具有rw-r--r--权限的文件,file_exists()函数始终返回FALSE要更改哪些访问权限?file_exists()返回FALSE

+1

与运行'chmod 755 /路径/到/ file.txt' –

+0

是否有可能做PHP不知何故变更许可?我的脚本也运行在同一台服务器上。 –

+0

1.它是'file_exists()'2.它实际上应该返回true,对于权限检查有'is_readable',所以检查你的文件路径,输出当前的'dirname(__ FILE __)',看看你的路径是否正确文件 –

回答

0

该功能实际上是file_exists(path)而不是file_exist()如果谈论php,并且file_exists()需要使用驱动器上的文件路径而不是URL。

所以,你应该这样做:

$file = '/var/www/html/scripts/asset/some_file.png'; 
if(file_exists($file)) 
{ 
    //Will enter here if the file actually exists in that path 
} 
+0

这是一个错字错误,我肯定使用了正确的函数名。 –