{
if (!empty($_COOKIE['history']))
{
$history = explode(',', $_COOKIE['history']);
array_unshift($history, $goodsId);
$history = array_unique($history);
while (count($history) > self::$_history_num)
{
array_pop($history);
}
setcookie('history', implode(',', $history), time() + 3600 * 24 * 30);
}
else
{
setcookie('history', $goodsId, time() + 3600 * 24 * 30);
}
}