php fopen返回false,但是文件可读/可写 [英] php fopen returns false but file is readable/writable
本文介绍了php fopen返回false,但是文件可读/可写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有一个可读可写的文件,但fopen返回false ...
have a file that is readable and writable but fopen is returning false...
if(is_readable($file)) echo 'readable ';
if(is_writable($file)) echo 'writable ';
$fp = fopen($file, 'a+');
var_dump($fp);
结果是
readable writable bool(false)
有什么想法吗?
确保它必须是允许的东西,但对文件尝试777却得到相同的结果.
sure it must be a permission thing but tried 777 on the file with same results.
推荐答案
让我们尝试获取更多信息.
什么
Let's try to get more information.
What does
$file = 'p:\muh';
error_reporting(E_ALL);
ini_set('display_errors', true);
echo 'phpversion: ', phpversion(), "\n";
echo 'uname: ', php_uname("s r"), "\n"; // name/release of the operating system
echo 'sapi: ', php_sapi(), "\n";
echo $file, file_exists($file) ? ' exists' : ' does not exist', "\n";
echo $file, is_readable($file) ? ' is readable' : ' is NOT readable', "\n";
echo $file, is_writable($file) ? ' is writable' : ' is NOT writable', "\n";
$fp = fopen($file, 'a+');
if ( !$fp ) {
echo 'last error: ';
var_dump(error_get_last());
}
else {
echo "ok.\n";
}
打印?
另请参阅: http://docs.php.net/error_get_last
这篇关于php fopen返回false,但是文件可读/可写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文