一步一步的排查問題,首先,肯定是服務器配置出了問題,和代碼無關。
於是去看nginx.conf,在網上查了很多關於這個問題的解決辦法,說的大致都一樣,就是在
location / { root D:/phpstudy_pro/WWW/Unifiedtransform/public/; index index.html index.htm index.php; gzip_static on; if (!-e $request_filename){ rewrite ^/(.*) /index.php last; } }
插入
try_files $uri $uri/ /index.php?$query_string;
但是還是沒有解決問題,后來往下看,看到這里引用了 vhost/*.conf
所以要在對應的vhost文件下的localhost /{}中加入這行代碼,就像這樣: