前言
为了快速开发一款小程序管理后台,在众多的php开源后台中,最终选择了基于thinkphp5的,轻量级的thinkadmin系统,进行二次开发。该系统支持php7。
文档地址
- ThinkAdmin-V5文档,http://doc.thinkadmin.top/thinkadmin-v5/1201769
- Thinkphp5文当,https://www.kancloud.cn/manual/thinkphp5/118003
- github源码地址,https://github.com/zoujingli/ThinkAdmin/tree/v5
- layui地址,https://www.layui.com/doc/
- ThinkAdmin-V5演示地址,https://v5.thinkadmin.top/admin/login.html
布署步骤
- 在github下载zip源码,解压到项目目录;
- 根据文档运行,本地开发命令php think run,使用http://127.0.0.1:8000访问项目;
- 本地vhost配置
server {
listen 80;
server_name local.thinkadmin.com;
root "/usr/local/nginx/html/thinkadmin/public";
location / {
index index.html index.htm index.php;
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=$1 last;
break;
}
}
location ~ \.php(.*)$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
include fastcgi_params;
}
}
遇到的问题
打印controller中的sql
打印sql
vendor/zoujingli/think-library/helper/PageHelper.php 88行
echo $this->query->getlastsql();exit;
AsyncCommand任务执行
linux环境需要给nginx运行权限
chown www.www -R thinkadmin
表单token有时候会验证失败
vendor/zoujingli/think-library/helper/PageHelper.php 72行
list($token, $time) = [uniqid($node), time()];//把'csrf'改成$node
集成Qcloud上传
结语
项目中很多的方法都是参照,thinkphp5手册,和layui文档完成。
感谢以上开源项目,欢迎交流学习。