使用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