duanjiangzhi6851 2013-03-23 14:05
浏览 464

为什么file_exists总是返回false?

When using file_exists(), it always returns false. But the file actually exists and can be loaded using require. This is my code:

// 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.");
    }
}

When I load the page, the page always exit(). I think the reason is the file_exists() function always return false.

  • 写回答

4条回答 默认 最新

  • duankang8114 2013-03-23 14:17
    关注

    $list in your foreach loop might be set incorrectly. Have you tried $list="class.data.".$list.".php"; ?

    评论

报告相同问题?

悬赏问题

  • ¥15 如何在3D高斯飞溅的渲染的场景中获得一个可控的旋转物体
  • ¥88 实在没有想法,需要个思路
  • ¥15 MATLAB报错输入参数太多
  • ¥15 python中合并修改日期相同的CSV文件并按照修改日期的名字命名文件
  • ¥15 有赏,i卡绘世画不出
  • ¥15 如何用stata画出文献中常见的安慰剂检验图
  • ¥15 c语言链表结构体数据插入
  • ¥40 使用MATLAB解答线性代数问题
  • ¥15 COCOS的问题COCOS的问题
  • ¥15 FPGA-SRIO初始化失败