<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>肖建彬的博客 &#187; setcookie</title>
	<atom:link href="http://www.xiaojb.com/archives/tag/setcookie/feed" rel="self" type="application/rss+xml" />
	<link>http://www.xiaojb.com</link>
	<description>奋斗无止境 爱拼才会赢</description>
	<lastBuildDate>Sun, 16 Oct 2011 14:27:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>.CN短域名在IE7下cookie难种难清的复杂问题</title>
		<link>http://www.xiaojb.com/archives/it/setcookie-on-short-domain.shtml</link>
		<comments>http://www.xiaojb.com/archives/it/setcookie-on-short-domain.shtml#comments</comments>
		<pubDate>Tue, 16 Dec 2008 04:12:26 +0000</pubDate>
		<dc:creator>xjb</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[cookie]]></category>
		<category><![CDATA[ie7]]></category>
		<category><![CDATA[setcookie]]></category>

		<guid isPermaLink="false">http://www.xiaojb.com/?p=703</guid>
		<description><![CDATA[早就听说了在ie7下，类似aa.cn的两字母.cn域名在种cookie的时候比较麻烦，现在是领教到了。 首先，aa.cn及其子域名在种cookie的时候不能指定cookiedomain，否则就种不上。 其次，跨域(cross-domain)的时候，使用了P3P头种下的cookie不能覆盖、清除在本域时种下的cookie，例如 bbs.aa.cn种下了名为sid的cookie，在blog.aa.cn调用bbs.aa.cn的程序清除sid的话，会失败，即使加了P3P的头也不行。 解决办法：1、将域名加入信任站点(trusted sites) 这一条对一个网站来说显然不适用。 2、在bbs.aa.cn种sid这个cookie的时候，也使用P3P头。 总结：IE7短域名情况下，P3P授权的Set-Cookie权限低于本域的Set-Cookie权限，解决办法就是加上P3P，让他们在一个层面上，具有相同的权限。]]></description>
			<content:encoded><![CDATA[<p>   早就听说了在ie7下，类似aa.cn的两字母.cn域名在种cookie的时候比较麻烦，现在是领教到了。<br />
  首先，aa.cn及其子域名在种cookie的时候不能指定cookiedomain，否则就种不上。<br />
  其次，跨域(cross-domain)的时候，使用了P3P头种下的cookie不能覆盖、清除在本域时种下的cookie，例如<br />
bbs.aa.cn种下了名为sid的cookie，在blog.aa.cn调用bbs.aa.cn的程序清除sid的话，会失败，即使加了P3P的头也不行。<br />
解决办法：1、将域名加入信任站点(trusted sites)    这一条对一个网站来说显然不适用。<br />
         2、在bbs.aa.cn种sid这个cookie的时候，也使用P3P头。</p>
<p>总结：IE7短域名情况下，P3P授权的Set-Cookie权限低于本域的Set-Cookie权限，解决办法就是加上P3P，让他们在一个层面上，具有相同的权限。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xiaojb.com/archives/it/setcookie-on-short-domain.shtml/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>[php] 如何解除页面输出对setcookie的影响？</title>
		<link>http://www.xiaojb.com/archives/it/how-to-setcookie-after-http-output.shtml</link>
		<comments>http://www.xiaojb.com/archives/it/how-to-setcookie-after-http-output.shtml#comments</comments>
		<pubDate>Mon, 12 May 2008 04:59:49 +0000</pubDate>
		<dc:creator>xjb</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[cookie]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[setcookie]]></category>

		<guid isPermaLink="false">http://www.xiaojb.com/?p=638</guid>
		<description><![CDATA[服务器向浏览器种cookie是通过http相应的头Set-Cookie来实现的，例如： Server: nginx/0.6.30 Date: Mon, 12 May 2008 04:58:21 GMT Content-Type: text/html; charset=gbk Transfer-Encoding: chunked Connection: keep-alive X-Powered-By: PHP/5.2.6 Vary: Accept-Encoding, Accept-Encoding Content-Encoding: gzip Set-Cookie: dznet_sid=CLu3BS; expires=Mon, 19-May-2008 04:59:43 GMT; path=/; domain=.discuz.net 假如在setcookie函数运行之前，php有输出，那么setcookie将会失效，经过实验，发现在php的顶部加入 ob_start(); 即使有输出，setcookie也不会报错。如果使用了gzip压缩，则是 ob_start('ob_gzhandler'); 测试方法]]></description>
			<content:encoded><![CDATA[<p>   服务器向浏览器种cookie是通过http相应的头Set-Cookie来实现的，例如：<br />
<code><br />
Server: nginx/0.6.30<br />
Date: Mon, 12 May 2008 04:58:21 GMT<br />
Content-Type: text/html; charset=gbk<br />
Transfer-Encoding: chunked<br />
Connection: keep-alive<br />
X-Powered-By: PHP/5.2.6<br />
Vary: Accept-Encoding, Accept-Encoding<br />
Content-Encoding: gzip<br />
<strong>Set-Cookie: dznet_sid=CLu3BS; expires=Mon, 19-May-2008 04:59:43 GMT; path=/; domain=.discuz.net</strong><br />
</code><br />
假如在setcookie函数运行之前，php有输出，那么setcookie将会失效，经过实验，发现在php的顶部加入<br />
<code><br />
ob_start();<br />
</code><br />
即使有输出，setcookie也不会报错。如果使用了gzip压缩，则是<br />
<code><br />
ob_start('ob_gzhandler');<br />
</code></p>
<p>测试方法<br />
<coolcode linenum="off" lang="PHP"><br />
<?php<br />
ob_start('ob_gzhandler');<br />
echo "x";<br />
var_dump(setcookie('x', time()));<br />
?><br />
</coolcode></p>
]]></content:encoded>
			<wfw:commentRss>http://www.xiaojb.com/archives/it/how-to-setcookie-after-http-output.shtml/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

