<?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; 页面跳转</title>
	<atom:link href="http://zhoumo123.cn/tag/%e9%a1%b5%e9%9d%a2%e8%b7%b3%e8%bd%ac/feed" rel="self" type="application/rss+xml" />
	<link>http://zhoumo123.cn</link>
	<description>知识分享，共同进步。zhoumo123.cn</description>
	<lastBuildDate>Thu, 07 Nov 2019 05:53:49 +0000</lastBuildDate>
	<language>zh-CN</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=4.0.1</generator>
	<item>
		<title>PHP页面跳转几种实现方法</title>
		<link>http://zhoumo123.cn/php/201.html</link>
		<comments>http://zhoumo123.cn/php/201.html#comments</comments>
		<pubDate>Fri, 08 Aug 2014 14:48:14 +0000</pubDate>
		<dc:creator><![CDATA[zhangc]]></dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[页面跳转]]></category>

		<guid isPermaLink="false">http://zhoumo123.cn/?p=201</guid>
		<description><![CDATA[此处介绍PHP中常用的实现页面自动跳转的方法。 PHP页面跳转一、header()函数 header()函数是PHP中进行页面跳转的一种十分简单的方法。header()函数的主要功能是将HTTP协议标头(header)输出到浏览器。 header()函数的定义如下： void header (string string [,bool replace [,int http_response_code]]) 可选参数replace指明是替换前一条类似标头还是添加一条相同类型的标头，默认为替换。 第二个可选参数http_response_code强制将HTTP相应代码设为指定值。 header函数中 ...  <a href="http://zhoumo123.cn/php/201.html">  阅读全文 </a>]]></description>
				<content:encoded><![CDATA[<p>此处介绍PHP中常用的实现页面自动跳转的方法。</p>
<h1><strong>PHP页面跳转一、header()函数</strong></h1>
<p>header()函数是PHP中进行页面跳转的一种十分简单的方法。header()函数的主要功能是将HTTP协议标头(header)输出到浏览器。</p>
<p>header()函数的定义如下：</p>
<p>void header (string string [,bool replace [,int http_response_code]])</p>
<p>可选参数replace指明是替换前一条类似标头还是添加一条相同类型的标头，默认为替换。</p>
<p>第二个可选参数http_response_code强制将HTTP相应代码设为指定值。 header函数中Location类型的标头是一种特殊的header调用，常用来实现页面跳转。</p>
<h2>注意：1.location和“:”号间不能有空格，否则不会跳转。</h2>
<p>2.在用header前不能有任何的输出。</p>
<p>3.header后的PHP代码还会被执行。例如，将浏览器重定向到zhoumo123.cn</p>
<pre class="brush: java; title: ; notranslate">

&lt;?php
//重定向浏览器
header(&quot;Location: http://zhoumo123.cn&quot;);
//确保重定向后，后续代码不会被执行
exit;
?&gt;

</pre>
<h1>PHP页面跳转二、Meta标签</h1>
<p>Meta标签是HTML中负责提供文档元信息的标签，在PHP程序中使用该标签，也可以实现页面跳转。 若定义http-equiv为refresh,则打开该页面时将根据content规定的值在一定时间内跳转到相应页面。</p>
<p>若设置content=&#8221;秒数;url=网址&#8221;，则定义了经过多长时间后页面跳转到指定的网址。例如，使用meta标签实现1秒后页面自动跳转到zhoumo123.cn。</p>
<pre class="brush: java; title: ; notranslate">

&lt;meta http-equiv=&quot;refresh&quot;  content=&quot;1;url=http://zhoumo123.cn&quot;&gt;

</pre>
<p>例如，以下程序meta.php实现在该页面中停留一秒后页面自动跳转到zhoumo123.cn。</p>
<pre class="brush: java; title: ; notranslate">

&lt;?php
$url = &quot;http://zhoumo123.cn&quot;; ?&gt;
&lt;html&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;refresh&quot; content=&quot;1; url=&lt;?php echo $url; ?&gt;&quot;&gt;
&lt;/head&gt;
&lt;body&gt;
页面只停留一秒……
&lt;/body&gt;
&lt;/html&gt;

</pre>
<h1>PHP页面跳转三、JavaScript</h1>
<p>例如，此代码可以放在程序中的任何合法位置。</p>
<pre class="brush: java; title: ; notranslate">

&lt;?php
$url = &quot;http://zhoumo123.cn&quot;;
echo &quot;&lt;script language='javascript' type='text/javascript'&gt;&quot;;
echo &quot;window.location.href='$url'&quot;;
echo &quot;&lt;/script&gt;&quot;;
?&gt;

</pre>
<p>以上就是我们向大家介绍的三种PHP页面跳转实现方法。</p>
]]></content:encoded>
			<wfw:commentRss>http://zhoumo123.cn/php/201.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
