Header() in PHP &html – Refresh (Redirect) to Location (URL) in X seconds,headerinphp_PHP教程
- WBOYOriginal
- 2016-07-13 09:56:451261browse
<p></p>
<h2>Header() in PHP &html – Refresh (Redirect) to Location (URL) in X seconds,headerinphp</h2>
<h2>Case 1 : Redirect a page to a URL without waiting in PHP.</h2>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="gutter">
1
</td>
<td class="code">
<code class="php plain">header(</code><code class="php string">"Location: index.php"</code><code class="php plain">);</code>
</td>
</tr>
</tbody>
</table>
<p> </p>
<h2>Case 2 : Redirect a page to an URL after waiting for X seconds in PHP.</h2>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="gutter">
1
2
3
4
5
</td>
<td class="code">
<code class="php plain"><?php</code>
<code class="php plain">header(</code><code class="php string">"Refresh: 5; url=index.php"</code><code class="php plain">);</code>
<code class="php functions">echo</code> <code class="php string">'Logged in successfully.'</code><code class="php plain">; ?></code>
</td>
</tr>
</tbody>
</table>
<h2> HTML code to redirect a webpage after X seconds.</h2>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="gutter">
1
</td>
<td class="code">
<code class="xml plain"><</code><code class="xml keyword">meta</code> <code class="xml color1">http-equiv</code><code class="xml plain">=</code><code class="xml string">"refresh"</code> <code class="xml color1">content</code><code class="xml plain">=</code><code class="xml string">"5; url=http://sau.comli.com/"</code><code class="xml plain">></code>
</td>
</tr>
</tbody>
</table>
<p align="left"></p>
<div style="display:none;">
<span id="url" itemprop="url">http://www.bkjia.com/PHPjc/986429.html</span><span id="indexUrl" itemprop="indexUrl">www.bkjia.com</span><span id="isOriginal" itemprop="isOriginal">true</span><span id="isBasedOnUrl" itemprop="isBasedOnUrl">http://www.bkjia.com/PHPjc/986429.html</span><span id="genre" itemprop="genre">TechArticle</span><span id="description" itemprop="description">Header() in PHP html – Refresh (Redirect) to Location (URL) in X seconds,headerinphp Case 1 : Redirect a page to a URL without waiting in PHP. 1 header( "Location: index.php" )...</span>
</div>
<div class="art_confoot"></div>
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn