Simple setting and deletion of cookie codes
Cookies are often used in web development to help us deal with some minor problems. Below we have written a simple code for setting and deleting cookies in the PHP cookie function.
/** * 设置cookie * n 名称 * c 值 * e 有效期 0 默认 一个月 1 关闭立即失效 */ function w_cookie($n, $c, $e = 0,$isdes=1) { if($isdes==1){$c=endes($c,deskey);} $exp = time() + 3600 * 24 * 30; if($e == 0) { setcookie($n, $c, $exp,"/"); } else { setcookie($n, $c,0,"/"); } } //关闭cookie方法 w_cookie('bb', 'www.php100.net', $e = 0,$isdes=1); //开启设置cookie方法 w_cookie('bb', 'www.php100.net', $e = 1,$isdes=1); ?>