上一个项目在api上使用了thinkphp5.1,但是后台还是使用thinkcmf5.0,tp版本是5.0 .当时就想统一thinkphp版本。最近得空有时间修改,因此在ThinkCMF 5.0.180901基础上将thinkphp版本改成5.1.29 。修改后,已经对本地测试的不兼容进行修改。
ThinkCMF 5.0.180901 正式版
thinkphp5.1.29
修改原因: \think\Loader 中注册vendor目录是写死的,没办法动态修改,除非重写Loader self::$composerPath = $rootPath . 'vendor' . DIRECTORY_SEPARATOR . 'composer' . DIRECTORY_SEPARATOR;
修改原因: \think\Loader 中注册vendor目录是写死的,没办法动态修改,除非重写Loader self::addAutoLoadDir($rootPath . 'extend');
原因: thinkphp5.1 配置重写整理,统一放在config目录,路由配置统一放在route目录
thinkcmf 原有配置多数放置在config/app.php文件中,其他配置,根据thinkphp5.1文档配置。extra_file_list,view_replace_str两个配置不再是系统配置,为了兼容thinkcmf 依然保留在app.php中。
在thinkphp5.1 默认app.php中添加include 'data/conf/config.php'
在thinkphp5.1 默认database.php 添加include 'data/conf/database.php';
__CAPTCHA_SRC=url('/newcaptcha/admin')
修改获取验证码路由。路由配置在cmf/common.php文件中定义。避免走默认的验证码控制器。$param = 'null';//'$temp' . uniqid();
避免没有参数的hook错误('field'=>['in',$data])
而是使用'field'=>$data