查找查询字符串时未定义索引


CakePHP Undefined index when looking for query string

显示'Undefined index: redirect'

错误

的代码:

        $came_from_site = $_GET['redirect'];
        if($came_from_site != "true")
        {
            echo 'USER TYPED IN URL MANUALLY';
        }

查询字符串不存在时发生错误....所以我想我需要检查a)它是否存在如果存在b)检查它的值是否为真

有人能帮忙吗?

谢谢

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

谢谢