php中cookies怎么设置多个值跟asp一样能设置多个值
发布网友
发布时间:2022-04-07 06:35
我来回答
共1个回答
热心网友
时间:2022-04-07 08:04
<?php
// set the cookies
setcookie("cookie[three]", "cookiethree");
setcookie("cookie[two]", "cookietwo");
setcookie("cookie[one]", "cookieone");
// after the page reloads, print them out
if (isset($_COOKIE['cookie'])) {
foreach ($_COOKIE['cookie'] as $name => $value) {
echo "$name : $value <br />\n";
}
}
?>
手册上的例子