我如何设置一个php cookie,以便他可以为iframe工作


How can I setup a php cookie so he can work for(with) iframe?

我想创建一个可以"捕获"<ifarme>的cookie。

以下是我的想象;

<iframe id='iframe' style='display: none; border: 0; height: 0; width: 0;' src='/setcookie.php'></iframe><div> example </div>

假设cookie过期时间应该是1天,我的问题是,"setcookie.php"(代码)应该是什么样子?

如果有人能解释/展示或以任何其他方式帮助我,我将非常尊重和感激。

听起来你只想用PHP:设置一个cookie

<?php
setcookie("TestCookie", $value, time()+3600);  /* expire in 1 hour */
?>

http://php.net/manual/en/function.setcookie.php