问题描述
这是我能提出的最简单的例子,但出于某种原因
(不是我浏览器的设置)它不起作用......
[页面顶部]
<?php
setcookie($ cookie_name," cookie_content",time()+ 3600);
?>
<!DOCTYPE HTML PUBLIC" - // W3C // DTD HTML 4.01 Transitional // EN"
" http:// www.w3.org/TR/html4/loose.dtd">
< html>
< head>
< title> cookie test< / title>
< meta http-equiv =" Content-Type"含量=" text / html的; charset = iso-8859-1">
< / head>
< body>
< p>
<?php
if(isset($ cookie_name))
{
print" Welcome! < br>" ;;
}
else
{
print" Go away。 ;
}
?>
< / p>
< / body>
< / html>
我错过了什么吗? thx
This is about the simplest example I could come up with, but for some reason
(not my browser''s settings) it''s not working...
[top of page]
<?php
setcookie($cookie_name, "cookie_content", time()+3600);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>cookie test</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<p>
<?php
if (isset($cookie_name))
{
print "Welcome! <br>";
}
else
{
print "Go away.";
}
?>
</p>
</body>
</html>
Am I missing something? thx
推荐答案
这篇关于饼干和PHP - 基础知识的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!