【问题标题】:Add 10 minutes expired time on cookie in php在 php 中的 cookie 上添加 10 分钟过期时间
【发布时间】:2017-06-23 23:41:30
【问题描述】:

我在 php 中有这个命令行来设置一个 cookie。

        document.cookie="<?php echo $_POST["setcookie"]; ?>"+"domain=.adidas.it;path=/";

我想加10分钟过期时间,谁能帮帮我?谢谢

【问题讨论】:

标签: javascript php html cookies


【解决方案1】:

有一个PHP函数可以设置cookie

setcookie ( string $name [, string $value [, int $expire = 0 [, string $path [, string $domain [, bool $secure = false [, bool $httponly = false ]]]]]] )

你的情况

$name = "yourname";
$value = "yourvalue";
$expire = time() + (60*10);
$domain = ".adidas.it";
$path = "/";
setcookie($name,$value,$expire,$path,$domain);

【讨论】:

    猜你喜欢
    • 2011-12-31
    • 1970-01-01
    • 1970-01-01
    • 2014-05-03
    • 1970-01-01
    • 2016-01-07
    • 1970-01-01
    • 1970-01-01
    • 2012-12-27
    相关资源
    最近更新 更多