Home >Backend Development >PHP Tutorial > 设置cookie有关问题

设置cookie有关问题

WBOY
WBOYOriginal
2016-06-13 12:46:01926browse

设置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 />


为什么一直都是输出new呢

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn