這裏是我的代碼:需要()失敗,即使file_exists()債權文件是存在的
if (file_exists('config.php')) {
require('config.php'); // This is line 38
}
這在某種程度上產生錯誤:
Warning: require(config.php) [function.require]: failed to open stream: No such file or directory in /path/name/file.php on line 38
如何在地球上這可能嗎?
更新:下面確實工作:
if (file_exists(getcwd(). '/config.php')) {
require(getcwd(). '/config.php');
}
奇怪。你可以在這些行之前嘗試'clearstatcache()'嗎? – 2012-02-25 22:19:56
似乎沒有影響任何東西。看到我更新的問題。 – Mike 2012-02-25 22:24:28
'is_readable()'而不是?在這種情況下,file_exists並不是特別有用,因爲您需要該文件實際上可被腳本讀取。把它看作是「銀行金庫裏有錢嗎」的區別?和「我可以把一些錢存入保險庫嗎?」 – 2012-02-25 22:24:46