GET, if, elseif

徘徊边缘 提交于 2019-12-14 04:06:05

问题


I've got one if, and one else in my script.

But I need something else for a $_GET statement so when people visit: URL.com/lol?code=23oojdosagodsj (or something like that) then I can do something inside (like an if, else).

if(isset($_GET['code'])) 
{
    echo $_GET['code'];
}

I've tried that, but it just redirects me to the else statement which shows the form. I used: ?code=lol


回答1:


In the code

if(isset($_GET['code'])) 
{
    echo $_GET['code'];
}

the echo statement will be executed if and only if you've provided a code variable in a GET-request. (like page.php?code=whatever).

From discussion below: It's the URL-rewriting mechanism that is causing the error. Disabling URL-rewriting solves the problem.



来源:https://stackoverflow.com/questions/9762491/get-if-elseif

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