Home > Backend Development > PHP Tutorial > Various methods to implement page jump in PHP

Various methods to implement page jump in PHP

韦小宝
Release: 2023-03-20 13:56:01
Original
108156 people have browsed it

We occasionally encounter the problem of page jump in PHP during PHP development. There are many ways to implement page jump in PHP. Today we will take a look at what methods PHP has to implement page jump. !

Recommended manual:php complete self-study manual

Let’s look directly at how to implement page jump in PHP!

1. PHP jump code in one sentence:

<?php $url = $_GET[&#39;url&#39;]; 
Header("Location:$url"); 
?>
Copy after login

2. PHP jump code if judgment:

if($_COOKIE["u_type"]){ 
    header(&#39;location:register.php&#39;); 
} 
else{ 
   setcookie(&#39;u_type&#39;,&#39;1&#39;,&#39;86400*360&#39;);//设置cookie长期有效 
    header(&#39;location:zc.html&#39;); 
}
Copy after login

3. PHP jump code javascript format:

<?php $url=czbin.php; 
echo "<!--<SCRIPT LANGUAGE="javascript">"; 
echo "location.href=&#39;$url&#39;"; 
echo "</SCRIPT>-->"; 
?>
Copy after login

4. PHP jump code HTML markup format (REFRESH attribute of META):

<HTML> 
<HEAD> 
<META HTTP-EQUIV="REFRESH" CONTENT="10"; URL=www.php.cn/> 
</HEAD> 
<BODY> 
</BODY> 
</HTML>
Copy after login

5. PHP jump code HTTP header information (Header function) formula:

<?php 
$url = czbin.php 
Header("HTTP/1.1 303 See Other"); 
Header("Location: $url"); 
exit;  
?>
Copy after login
Recommended related articles :
1.PHP Several implementation methods of jumping pages
2.How to implement the page jump function in PHP? (Example of function tags)
Related video recommendations:
1.Dugu Jiujian(4)_PHP video tutorial

Among the various methods of page jump mentioned above in PHP, which one you haven’t heard of before, you can try it yourself!

The above is the detailed content of Various methods to implement page jump in PHP. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template