|
復(fù)制代碼 代碼如下:
setcookie("ICNET[Reg]", "This is reg cookie", time() + 3600);
setcookie("ICNET[Active]", "This is login cookie.", time() + 3600);
print_r($_COOKIE);
/*Result:
Array ( [ICNET] => Array ( [Reg] => This is reg cookie [Active] => This is login cookie ) [phpSESSID] => nsi2q5upuvqrik6notaohjd7p3 )
*/
讀取:
復(fù)制代碼 代碼如下:
echo $_COOKIE['ICNET']['Reg'];
echo $_COOKIE['ICNET']['Active'];
//或者
$arr_cookie = $_COOKIE['ICNET'];
echo $arr_cookie['Reg'];
echo $arr_cookie['Active'];
銷毀:
復(fù)制代碼 代碼如下:
setcookie('ICNET[Reg]', '', time() - 3600);
setcookie('ICNET[Active]', '', time() - 3600);
php技術(shù):基于PHP創(chuàng)建Cookie數(shù)組的詳解,轉(zhuǎn)載需保留來源!
鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請第一時(shí)間聯(lián)系我們修改或刪除,多謝。