【发布时间】:2013-10-09 23:34:30
【问题描述】:
大家好,我只在 chrome 中遇到setcookie() 的问题。它在 Firefox 中运行良好。
这是我使用 cookie 的功能
function step3($voice_choice = null)
{
if (!empty($voice_choice))
{
setcookie("voice_choice", $voice_choice, time() + 2000, "/");
}
}
当我打印 $_COOKIE 时输出是
Array ( [CAKEPHP] => s247c7mlagt5am6h323cm7pqj0 [voice_choice] => favicon.ico )
voice_choice 的值不是我在上面的函数中设置的。
【问题讨论】:
-
也许是浏览器的配置问题,不总是接受cookies,也许你放的路径是相关的。您是否尝试过其他 webkit 浏览器,例如 Safari?
-
显示你用来调用
step3()的代码 -
.ctp 文件中有一个调用 step3() 的链接。 link("FEMALE", array('controller' => 'survey', 'action' => "step3/female"),array("class"=>"option_image")); ?> link("MALE", array('controller' => 'survey', 'action' => "step3/male"),array("class"=>"option_image") );?>
标签: php google-chrome cookies