扫码关注官方订阅号
命名空间与目录不一致导致无法引入GitElephant类库
最后这样解决了:
下载地址: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.
定义alias配置文件。这个可以实现配置文件路径和命名空间的指向问题。http://document.thinkphp.cn/manual_3_2.html#autoload可以看类库映射这个小节。
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
最后这样解决了:
下载地址:http://www.opencmf.cn
用import引入,或者直接require.
定义alias配置文件。
这个可以实现配置文件路径和命名空间的指向问题。
http://document.thinkphp.cn/manual_3_2.html#autoload
可以看类库映射这个小节。