开发者

problem with seting GET value

开发者 https://www.devze.com 2022-12-24 01:40 出处:网络
in my site i want to set default page to open, using this script if (!isset($_GET)) { $_GET[\'id\'] = \"home\";

in my site i want to set default page to open, using this script

if (!isset($_GET)) 
{
    $_GET['id'] = "home";
}

when i open index.php it开发者_JAVA百科 must set $_GET['id'] = "home" but it doesn't work. can somebody explain why?


Try:

if (empty($_GET['id'])) 
{
    $_GET['id'] = "home";
}

The $_GET variable itself will always be set, which is why your current code isn't working.


That should be:

if (!isset($_GET['id']))
0

精彩评论

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