无法读取PHP Laravel中的URL参数 [英] Can't read url params in php laravel
问题描述
我在将laravel中的站点部署到服务器时遇到问题.
I'm having problems on deploying a site in laravel to a server.
在localhost上工作时,我可以从URL读取参数,例如
When working on localhost I can read params from URL like
.../v1/test?a=hi&b=bye
我使用Input::all()
来查看所有可用的参数.我还用$_GET
进行了检查,并且都显示了我通过的参数.
I use Input::all()
to see every param available. I also check it with $_GET
and both display the params I pass.
将其部署到服务器后,似乎无法使用Input::all()
或$_GET
从URL中读取任何参数.我得到的是
Once I deploy it to the server I can't seem to read any param from the URL with Input::all()
nor $_GET
. What I get is
Array
(
[/v1/test] =>
)
我已经用简单的PHP检查了服务器配置,并且可以读取它,所以我猜想这是一种骗术.
I've checked the server config with a simple PHP and I can read it so I guess it's some kind of trickery.
我在服务器上使用PHP 5.4.24,在本地主机上使用5.4.7
I'm using PHP 5.4.24 on server and 5.4.7 on localhost
推荐答案
似乎问题出在.htaccess上
It seems the problem was with .htaccess
重写模式更改了URL,使得无法看到vars
The rewrite mode changed the URL and made it impossible to see the vars
我回到了默认的htaccess(我不记得更改过)
I've gone back to the default htaccess (which I don't recall changing)
您可以在这里找到它: laravel的htaccess
You can find it here: laravel's htaccess
这篇关于无法读取PHP Laravel中的URL参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!