GET, if, elseif

2019-08-23 12:56发布

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条回答
ら.Afraid
2楼-- · 2019-08-23 13:40

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.

查看更多
登录 后发表回答