framework/base/helper.class.php 中的 import() 存在 BUG

2017-12-06 12:11:43
Kevin
  • 访问次数: 5
  • 注册日期: 2017-12-06
  • 最后登录: 2017-12-21
  • 我的积分: 173
  • 门派等级: 无门派
static public function import($file)
{
    $file = realpath($file); // 需要增加此处理,否则会因为相对路径和绝对路径导致 redeclare class 错误
    if(!is_file($file)) return false;

    static $includedFiles = array();
    if(!isset($includedFiles[$file]))
    {
        include $file;
        $includedFiles[$file] = true;
        return true;
    }

    return true;
}
沙发
2017-12-06 13:51:49
石洋洋
  • 访问次数: 6461
  • 注册日期: 2011-04-06
  • 最后登录: 2024-04-19
  • 我的积分: 96502
  • 门派等级: 幽灵 等级6 修罗
谢谢反馈。
1/1 1