<?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>header &#8211; LPC影子技术分享</title>
	<atom:link href="https://www.mudbest.com/tag/header/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.mudbest.com</link>
	<description>行影不离,忘之却步.</description>
	<lastBuildDate>Mon, 01 Oct 2012 11:46:01 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.2</generator>
	<item>
		<title>PHP设置页面编码</title>
		<link>https://www.mudbest.com/php%e8%ae%be%e7%bd%ae%e9%a1%b5%e9%9d%a2%e7%bc%96%e7%a0%81/</link>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Fri, 01 Apr 2011 02:13:43 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[header]]></category>
		<guid isPermaLink="false">http://www.mudbest.com/?p=523</guid>

					<description><![CDATA[关于php的header()函数的介绍如下： 定义和用法 header() 函数向客户端发送原始的 HTTP  ... <a title="PHP设置页面编码" class="read-more" href="https://www.mudbest.com/php%e8%ae%be%e7%bd%ae%e9%a1%b5%e9%9d%a2%e7%bc%96%e7%a0%81/" aria-label="阅读 PHP设置页面编码">阅读更多</a>]]></description>
										<content:encoded><![CDATA[<pre class="brush: php; title: ; notranslate">
header(&quot;Content-Type:text/html; charset=utf-8&quot;);
</pre>
<p>关于php的header()函数的介绍如下：</p>
<p>定义和用法<br />
header() 函数向客户端发送原始的 HTTP 报头。<br />
认识到一点很重要，即必须在任何实际的输出被发送之前调用 header() 函数（在 PHP 4 以及更高的<span id="more-523"></span>版本中，您可以使用输出缓存来解决此问题）：</p>
<pre class="brush: xml; title: ; notranslate">
&lt;!-- // 结果出错 // 在调用 header() 之前已存在输出 header('Location: http://www.mudbest.com/');--&gt;
</pre>
<p>语法</p>
<pre class="brush: php; title: ; notranslate">
header(string,replace,http_response_code)
</pre>
<table>
<tbody>
<tr>
<th>参数</th>
<th>描述</th>
</tr>
<tr>
<td>string</td>
<td>必需。规定要发送的报头字符串。</td>
</tr>
<tr>
<td>replace</td>
<td>可选。指示该报头是否替换之前的报头，或添加第二个报头。</p>
<p>默认是 true（替换）。false（允许相同类型的多个报头）。</td>
</tr>
<tr>
<td>http_response_code</td>
<td>可选。把 HTTP 响应代码强制为指定的值。（PHP 4 以及更高版本可用）</td>
</tr>
</tbody>
</table>
<p>提示和注释<br />
注释：从 PHP 4.4 之后，该函数防止一次发送多个报头。这是对头部注入攻击的保护措施。</p>
<p>例子1</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
// Date in the past
header(&quot;Expires: Mon, 26 Jul 1997 05:00:00 GMT&quot;);
header(&quot;Cache-Control: no-cache&quot;);
header(&quot;Pragma: no-cache&quot;);
?&gt;
</pre>
<p>注释：<br />
用户可能会设置一些选项来更改浏览器的默认缓存设置。通过发送上面的报头，您可以覆盖任何这些设置，强制浏览器不进行缓存！</p>
<p>例子 2<br />
提示用户保存一个生成的 PDF 文件（Content-Disposition 报头用于提供一个推荐的文件名，并强制浏览器显示保存对话框）：</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
header(&quot;Content-type:application/pdf&quot;);

// 文件将被称为 downloaded.pdf
header(&quot;Content-Disposition:attachment;filename='downloaded.pdf'&quot;);

// PDF 源在 original.pdf 中
readfile(&quot;original.pdf&quot;);
?&gt;
</pre>
<p>注释：<br />
微软 IE 5.5 存在一个阻止以上机制的 bug。通过升级为 Service Pack 2 或更高的版本，可以解决该 bug。</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>header对文本进行下载思路</title>
		<link>https://www.mudbest.com/header%e5%af%b9%e6%96%87%e6%9c%ac%e8%bf%9b%e8%a1%8c%e4%b8%8b%e8%bd%bd%e6%80%9d%e8%b7%af/</link>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Fri, 01 Apr 2011 02:13:09 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[header]]></category>
		<guid isPermaLink="false">http://www.mudbest.com/?p=524</guid>

					<description><![CDATA[&#60;?php header(&#34;Content-Type: application/force-d ... <a title="header对文本进行下载思路" class="read-more" href="https://www.mudbest.com/header%e5%af%b9%e6%96%87%e6%9c%ac%e8%bf%9b%e8%a1%8c%e4%b8%8b%e8%bd%bd%e6%80%9d%e8%b7%af/" aria-label="阅读 header对文本进行下载思路">阅读更多</a>]]></description>
										<content:encoded><![CDATA[<pre class="brush: php; title: ; notranslate">
&lt;?php 
header(&quot;Content-Type: application/force-download&quot;); 
header(&quot;Content-Disposition: attachment; filename=&quot;.basename($_GET&#x5B;'url'])); 
readfile($filename); 
?&gt; 
</pre>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
