设置Cookie时要把一个json整体放入Cookie而不是单独放入,影响效率. var Cookies = {}; /** * 设置Cookies */ var Cookies = {}; /** * 设置Cookies */ Cookies.set = function(name, value){ var argv = arguments; var argc = arguments.len
1.设置cookie及有效期时长 //cname:cookie的名称,cvalue:cookie的内容,exdays:cookie有效期时长: function setCookie(cname, cvalue, exdays) { var d = new Date(); // d.setTime(d.getTime() + (exdays*1000));//设置过期时间是多少天后: // d.setTime(d.getTime() + (exdays*60*60*1000));//设置过期时间是
在php中设置cookie. $email="abc@163.com"; setcookie("y_email",$email,time()+3600,"/"); js中获取cookie function getCookie(c_name) { if (document.cookie.length>0) { c_start=document.cookie.indexOf(c_name + "=") if (c_start