且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Slim 框架的路由问题

更新时间:2023-09-01 23:32:04

最后发现问题出在错误的文档根目录下.

Eventually, I found out that the problem was given by a wrong document root.

我使用 php -S localhost:8080 public/index.php 从我的项目的主文件夹启动应用程序,这导致了 HTTP 的 PATH_INFO 标头请求不被编译.

I was launching the application from the main folder of my project using php -S localhost:8080 public/index.php and this caused the PATH_INFO header of the HTTP request not to be compiled.

将目录更改为 ./public 并使用 php -S localhost:8080 index.php 启动应用程序解决了问题

Changing directory to ./public and launching the app using php -S localhost:8080 index.php solved the problem