problem with seting GET value
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']))
精彩评论