php网站的coockie
php网站的coockie
我建议是构造函数
因为那样可惜携带json
function cookie($name, $val = '', $date = 25920000) { if ($val === null) $date = -5; if ($val === '') return json_decode($_COOKIE[$name], true); return setcookie($name, json_encode($val), is_numeric($date) ? $date + time() : 0, '/'); }