我有以下两个链接:PHP创建和删除cookies
<a href="index.php?showDesktop=true">Show Desktop</a>
<a href="index.php?showMobile=true">Show Mobile</a>
我想要做的就是让这个如果单击showDesktop查询,然后创建一个名为showDesktop cookie,并删除cookie showMobile,反之亦然。到目前为止,我尝试了以下方法,但认为我做错了。任何人都可以帮助我按照建议进行工作。
if($_GET['showDesktop']) {
$_COOKIE('showDesktop', 'yes');
$_COOKIE('showMobile', null);
}
else if($_GET['showMobile']) {
$_COOKIE('showDesktop', null);
$_COOKIE('showMobile', 'yes');
}
'$ _COOKIE'不是函数删除Cookie。 –