----------------------------------------------------------
1、安装PHP8
2、升级TP核心包至TP8
方法一:按照thinkphp官方指引,从tp6升级到tp8
方法二:如果您没有使用composer 安装过别的依赖,也可以直接使用“vendor文件包”里的文件
3、覆盖主程序
复制“覆盖主程序”文件夹里的文件进行覆盖
删除app/common/model里的系统文件(Admin.php、AdminLog.php、AuthGroup.php、AuthGroupAccess.php、AuthRule.php、UploadFiles.php)
4、修改“配置管理”
如果您新增了自己的配置,请按配置管理二开修改(http://xnadmin.cn/index/Doc/index.html#item6)
后台修改菜单(权限管理-权限控制)
admin/config/base 改为 admin/config/index
5、导入数据表 xn_upload_class.sql
6、修改app\common.php文件
受影响的有两个方法函数(xn_add_admin_log、 xn_upload_one),复制下面代码分别覆盖
1 2 3 4 5 6 7 8 9 10 11 12 13 | function xn_add_admin_log( $remark ) { $data = [ 'admin_id' => session( 'admin_auth.id' ), 'url' => request()->url(true), 'ip' => request()->ip(), 'remark' => $remark , 'method' =>request()->method(), 'param' => json_encode(request()->param()), 'create_time' => time() ]; \app\common\model\AdminLogModel::insert( $data ); } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | function xn_upload_one( $value , $file_name , $water =null, $thumb =null) { $html =<<<php <div class = "xn-upload-box" > <div class = "t layui-col-md12 layui-col-space10" > <input type= "hidden" name= "{$file_name}" class = "layui-input xn-images" value= "{$value}" > <div class = "layui-col-md12" > <div type= "button" class = "layui-btn webuploader-container" id= "{$file_name}" data-water= "{$water}" data-thumb= "{$thumb}" style= "width: 113px;" ><i class = "layui-icon layui-icon-picture" ></i>上传图片</div> <div type= "button" class = "layui-btn chooseImage" data-num= "1" ><i class = "layui-icon layui-icon-table" ></i>选择图片</div> </div> </div> <ul class = "upload-ul clearfix" > <span class = "imagelist" ></span> </ul> <script>$( '#{$file_name}' ).uploadOne();</script> </div> php; return $html ; } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | /** * 错误信息 - 为API设计的返回错误信息的方法 * @param string $msg * @param int $code * @param array $data */ function retError( $msg = 'fail' , $code = 0, $data = []) { $result = [ 'msg' => $msg , 'code' => $code , 'data' => $data ]; $response = json( $result ); throw new \think\exception\HttpResponseException( $response ); } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | /** * 成功信息 - 为API设计的返回数据的方法 * @param array $data * @param string $msg * @param int $code */ function retSuccess( $data = [], $msg = 'success' , $code = 1) { $result = [ 'data' => $data , 'msg' => $msg , 'code' => $code ]; $response = json( $result ); throw new \think\exception\HttpResponseException( $response ); } |
----------------------------------------------------------