我想在我的PHP项目中设置cookie,我的代码是
setcookie("gi_cur", "USD", time() + (8886400 * 130), "/");
但这不起作用....目前我使用的是PHP 7.0版 有人可以帮帮我吗 感谢
答案 0 :(得分:2)
bool setcookie ( string $name [, string $value = "" [, int $expire = 0 [, string $path = "" [, string $domain = "" [, bool $secure = false [, bool $httponly = false ]]]]]] )
<?php
$value = 'something from somewhere';
setcookie("TestCookie", $value);
setcookie("TestCookie", $value, time()+3600); /* expire in 1 hour */
setcookie("TestCookie", $value, time()+3600, "/~rasmus/", "example.com", 1);
?>