Heim >Backend-Entwicklung >PHP-Tutorial > 设置cookie有关问题
设置cookie问题
<br /> if(isset($_COOKIE['history']))<br /> {<br /> $history = explode(',', $_COOKIE['history']);<br /> <br /> array_unshift($history, $id);<br /> $history = array_unique($history);<br /> <br /> while (count($history) > 5)<br /> {<br /> array_pop($history);<br /> }<br /> <br /> setcookie('history',implode(',', $history),80000);<br /> echo 'add';<br /> }<br /> else<br /> {<br /> setcookie('history',$id,80000);<br /> echo 'new';<br /> }<br />