使用file_exists(
時),它總是返回false。但該文件實際存在,可以使用require
加載。這是我的代碼:爲什麼file_exists總是返回false?
// Creating dependency lists.
$data_dependency = array("mysql", "oracle", "postgresql", "sqlite", "access");
// Calling the dependecny files.
foreach ($data_dependency as $list) {
$list = "class.data.$list.php";
_system::debug("Calling required class $list ...");
if (file_exists($list)) {
include($list);
_system::debug("Calling $list was successfull.");
} else {
_system::debug("Calling $list was failed. Now we close the system load.");
exit("Calling $list was failed. Now we close the system load.");
}
}
當我加載頁面時,頁面總是exit()
。我認爲原因是file_exists()
函數總是返回false。
嘗試使用絕對路徑。 – C9HDN 2013-03-23 14:09:00
你說文件單數存在,但你正在尋找5,如果任何一個不存在它將退出 – Crisp 2013-03-23 14:09:05
@Calum - 我試圖使用絕對路徑,但仍然是錯誤的。 – 2013-03-23 14:25:58