通过设置data-url可以指定接口,data-url="{:url('ajax/upload')}"
<button type="button" id="faupload-local" class="btn btn-primary faupload" data-input-id="c-local" data-multiple="true" data-preview-id="p-local" data-url="{:url('ajax/upload')}"><i class="fa fa-upload"></i> {:__("Upload to local")}</button>
首先,配置了thinkphp的伪静态。
配置没问题,但依然404,就试一下以下方法。
测试
http://127.0.0.1/ZePSxxxxr.php?s=/index/login
成功打开,估计是伪静态的问题。
在nginx配置文件中添加以下配置项,针对ZePSxxxxr的。
location ^~ /ZePSxxxxr.php/ {
if (!-e $request_filename){
rewrite ^\/ZePSxxxxr\.php(.*)$ /ZePSxxxxr.php?s=$1 last; break;
}
}
location / {
if (!-e $request_filename){
rewrite ^(.*)$ /index.php?s=$1 last; break;
}
}
assets模块不存在,
后台目录模块不存在等错误都是nginx的配置问题所致,请参考以下配置信息。
我的环境:php7.4,容器方式各自运行php和nginx
server {
listen 80;
root nginx容器下的目录;
index index.php index.html index.htm index.nginx-debian.html;
server_name www.xxx.com;
location / {
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php?s=/$1 last;
break;
}
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
location ~ \.php(.*)$ {
fastcgi_pass php容器或127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
fastcgi_param SCRIPT_FILENAME php容器下的目录$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
如果,提示是thinkphp等文件不存在等错误:
一般是没有在服务器上运行composer update或install,导致目录中不存在thinkphp和vendor
如果是容器运行php,不方便运行composer,可以修改.gitignore文件中,注释掉thinkphp和vender,使这两个目录在git上也同步。
#/thinkphp/
#/vendor/
如果,还是有后台的ui异常,不能点击菜单等问题,一般也是gitignore文件中以下目录排除所致,与上一步一样把这些目录注释掉,使其同步。
# /addons/*
# /public/assets/libs/
# /public/assets/addons/*
最后在服务器上拉取所有文件即可正常运行fastadmin后台。