php同名cookie,php设置的cookie和js设置的cookie可以同名存在

php设置的cookie和js设置的cookie可以同名存在0

00e27ab806e4881f8254fe7ae8741834.pngkb123242013.07.26浏览139次分享举报

发现js设置完cookie后再用php重设置cookie竟然同名同时存在,而且用php取出cookie的值还是js设置的那个值,不理解??<?php

if($_GET['act']=='m_time' )

{

$m_time = $_POST['m_time13'];

unset($_COOKIE['m_time']);

setcookie('m_time',$m_time,time()+60*60*24*600,'/');

header('location:'.$_SERVER['HTTP_REFERER']);

}

?>

无标题文档

function checktime(){

m_time = document.timeform.m_time13.value;

var pattern = /^(\d{4})-(\d{1,2})-(\d{1,2})$/g;

if(!pattern.test(m_time)){

alert('格式不正确,格式如(2010-01-01)');

return ;

}

document.timeform.submit();

}

function CookieEnable()

{

var result=false;

if(navigator.cookiesEnabled)

return true;

document.cookie = "testcookie=yes;";

var cookieSet = document.cookie;

if (cookieSet.indexOf("testcookie=yes") > -1)

result=true;

document.cookie = "testcookie=";

return result;

}

if(!CookieEnable())

{

alert("对不起,您的浏览器的Cookie功能被禁用,请开启");

}     alert(document.cookie);

if(document.cookie.indexOf("m_time")=='-1'){

document.cookie="m_time=2010-08-14";

//SetCookie('m_time','2010-08-14');

document.URL='untitled-1.php';

}

时间:
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值