$_GET is empty when the url has variables

一笑奈何 提交于 2019-11-29 14:47:57

When I run into something that stumps me like this, I always take my script right down to basics. Try this at the very top of your script:

var_dump($_GET);
exit;

Then you can see if in fact it is getting the vars from the hook. If not, then there may be something deeper... like is PHP really running with Apache? If it works, start adding in other things until it stops again and you can start narrowing down the culprit.

Moving this into an answer from my comments above. Two reasons your GET params might be missing. Either you have mode rewrite set up that removes them or you are using a framework, such as CodeIgniter that moves them elsewhere.

In case you are using CodeIgniter you can re-enable them with parse_str($_SERVER['QUERY_STRING'], $_GET);

Make sure your php.ini file doesn't set max_input_vars to 0. I accidentally set mine to something else so adding anything to $_GET created a PHP warning.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!