php设置与打印cookie值的例子。
代码:
复制代码 代码示例:
<?php
setcookie( "vegetable", "artichoke", time()+3600, "/","jb200.com", 0 );
?>
<html>
<head>
<title>设置与打印cookie值的例子-www.jb200.com</title>
</head>
<body>
<?php
if ( isset( $_COOKIE['vegetable'] ) ) {
print "<p>再来一次,你选择的水果是:";
print "{$_COOKIE['vegetable']}</p>";
} else {
print "<p>你好,欢迎来到脚本学堂。</p>";
}
?>
</body>
</html>