有一个可读写的文件,但fopen返回false ...
if(is_readable($file)) echo 'readable ';
if(is_writable($file)) echo 'writable ';
$fp = fopen($file, 'a+');
var_dump($fp);
Run Code Online (Sandbox Code Playgroud)
结果是
readable writable bool(false)
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
确定它必须是权限,但在文件上尝试777具有相同的结果.
Vol*_*erK 17
让我们尝试获取更多信息.
是什么
$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";
}
Run Code Online (Sandbox Code Playgroud)
打印?
另见:http://docs.php.net/error_get_last
| 归档时间: |
|
| 查看次数: |
17683 次 |
| 最近记录: |