ThinkPHP在这种情况下该如果导入第三方类库

命名空间与目录不一致导致无法引入GitElephant类库
图片描述

阅读 3.7k
3 个回答

最后这样解决了:

下载地址:http://www.opencmf.cn

// 注册特殊autoload
spl_autoload_register(function ($class) {
    $path = APP_PATH . "Git/Util/";
    $filename = $path . str_replace('\\', '/', $class) . '.php';
    if (is_file($filename)) {
        // Win环境下面严格区分大小写
        if (IS_WIN && false === strpos(str_replace('/', '\\', realpath($filename)), $class . '.php')) {
            return;
        }
        include $filename;
    }
    if (file_exists($filename)) { 
        require_once $filename; 
    }
});

用import引入,或者直接require.

推荐问题