【问题标题】:how to clear out a cookie in php如何清除php中的cookie
【发布时间】:2018-06-08 07:30:57
【问题描述】:

我有一个包含字母 a 的 cookie 我还有一个名为 clear 的按钮,当用户单击清除按钮时我希望字母 a 不在 cookie 中,但我仍然想保留 cookie 只是需要为空

这是我的代码

清除按钮

<form action="" method="POST">
 <button type="submit" name="clear" id="clear">clear</button> 
</form>

还有我的 cookie 代码

setcookie('a', 'a', time()+1045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852104545432357027027183560378521045454323570270271835603785210454543235702702718356037852);

【问题讨论】:

  • time()+ ... 什么?
  • 能否请您给我您的代码版本,谢谢

标签: php cookies


【解决方案1】:

'...但我仍然想保留 cookie。 cookie 只需为空' - 我认为这意味着修改 cookie。

$a = ''; 

setcookie($a, $a, time() + (86400 * 30), '/'); // will clear the 'a' cookie.

如果这不是你想要的,请原谅我。

time()[ 当前时间 ] + 86400( 1 天 ) * 30 表示正式的 'a' cookie 将在 30 天后过期。

【讨论】:

    猜你喜欢
    • 2012-06-10
    • 2012-05-23
    • 2017-07-15
    • 2014-01-26
    • 1970-01-01
    • 1970-01-01
    • 2017-08-14
    • 2022-05-12
    • 2013-08-18
    相关资源
    最近更新 更多