开发者

CakePHP Undefined index when looking for query string

开发者 https://www.devze.com 2023-03-31 18:47 出处:网络
I get an error saying \'Undefined index: redirect\' with this code: $came_from_site = $_GET[\'redirect\'];

I get an error saying 'Undefined index: redirect'

with this code:

        $came_from_site = $_GET['redirect'];
        if($came_from_site != "true")
        {
 开发者_开发知识库           echo 'USER TYPED IN URL MANUALLY';
        }

The error happens when the query string doesn't exist.... So I guess I need to check if a) it exists and then if it does b) check that it's value is true

Can anyone help?

Thanks


if(empty($_GET['redirect'])){
    echo 'USER TYPED IN URL MANUALLY';
}

Thanks

0

精彩评论

暂无评论...
验证码 换一张
取 消