1
從我用這個代碼調試打開文件PHP:未能打開流:文件存在
echo'<pre>';
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 readable', "\n";
$fp = @fopen($file, 'x');
if (! $fp) {
echo 'last error: ';
var_dump(error_get_last());
}
echo '</pre>
的失敗,我得到這個有用的消息
D:\data\openid\nonces\4d895d80---2jmj7l5rSw0yVb.vlWAYkK.YBwk-Bk0DdMtjVYDVZi0npvGwNNFSRy0
phpversion: 5.3.1
uname: Windows NT
D:\data\openid\nonces\4d895...FSRy0 exists
D:\data\openid\nonces\4d895...FSRy0 is readable
D:\data\openid\nonces\4d895...FSRy0 is writable
last error: array(4) {
["type"]=>
int(2)
["message"]=>
string(188) "fopen(D:\data\openid\nonces\4d895d80---2jmj7l5rSw0yVb.vlWAYkK.YBwk-Bk0DdMtjVYDVZi0npvGwNNFSRy0) [function.fopen]: failed to open stream: File exists"
["file"]=>
string(38) "D:\web\library\Utils.php"
["line"]=>
int(179)
}
類似的問題「未能開放流:文件存在「 - 這意味着什麼?
實際上,'x'標誌位是我集成的開放ID庫的一部分https://github.com/openid/php-openid我需要在那裏請求支持,我猜想,他們故意放置該標誌 – Moak 2011-03-23 03:23:57
其目的當然是防止覆蓋現有的文件。我假設他們正在使用它自己創建會話文件。 – mario 2011-03-23 03:26:15