问题
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