PHP laravel 8 学习踩坑之旅(伪静态规则)
- 利用
laravel 脚手架搭建完项目

-
通过php-study 集成环境开启服务器  -
访问htt.test,一切都很美好

-
修改路由,准备测试一下功能  -
直接访问 htt.test/home,哦豁,痛苦开始

- 不断的尝试发现,当把url改变成 htt.test/index.php/home 后可以访问

-
菜鸡的我在经过长达半天的搜集博客与无数次的重装项目,检测环境…,终于在这篇博客 https://www.copylian.com/technology/357.html 中发现了一个没有见过的东西 伪静态规则 凭着程序员的直觉,我觉得就是它了,Ctrl+c,Ctrl+v 把这段配置加到了php-study网站配置的伪静态规则中。 找了一份详细的代码 THINKCMF-Nginx伪静态规则

location / {
if (!-e $request_filename){
rewrite ^(.*)$ /index.php?s=$1 last; break;
}
}
location ~ /.*\.php/ {
rewrite ^(.*?/?)(.*\.php)(.*)$ /$2?s=$3 last;
break;
}
奇迹出现了!ohohohohohoohoh~

本次的踩坑就此结束了!
自学的历程是痛苦的,虽然是一个小问题,但当它被自己解决之后,成就感满满
核桃桃,一个菜鸡前端,全栈的路上。
|