Home > Article > Backend Development > How to redirect web pages in PHP
This article will introduce to you how to redirect web pages in PHP. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to everyone.
Today I used the redirect page when doing the user login function. I am more interested and learned and summarized three methods to deepen my memory.
The first one: Use the header() function for redirection, which is what I use most. (Note! There cannot be a space between locationhe and ":", otherwise it will have no effect!)
<?php header('content-type:text/html;charset=uft-8); //重定向页面 header('location:index.php'); ?>
Second: Use the meta tag in the HTML header to define http-equiv=refresh and content="jump The time it takes to transfer (in seconds); url = jump address”
76c82f278ac045591c9159d381de2c57 100db36a723c770d327fc0aef2ce13b1 93f0f5c25f18dab9d176bd4f6de5d30e a80eb7cbb6fff8b0ff70bae37074b813 //跳转页面,跳转时间:3秒钟,目标地址:index.php fe976411cf15f8c5705b61e304fdc24b b2386ffb911b14667cb8f0f91ea547a7skip...6e916e0f7d1e588d4f442bf645aedb2f 9c3bca370b5104690d9ef395f2c5f8d1
or
9ef86001f4a7b2b310d39cd9febb654b 76c82f278ac045591c9159d381de2c57 100db36a723c770d327fc0aef2ce13b1 93f0f5c25f18dab9d176bd4f6de5d30e a80eb7cbb6fff8b0ff70bae37074b813 //跳转页面,跳转时间:2秒钟,目标地址:index.php 1ee083658c7831e0de23b0a8e8fb19ef"> b2386ffb911b14667cb8f0f91ea547a7skip...6e916e0f7d1e588d4f442bf645aedb2f 9c3bca370b5104690d9ef395f2c5f8d1
The third way: use javascript to jump
fbc6423d98f8ea5ff02da30b5b62c933window.location.href='$url';2cacc6d41bbb37262a98f745aa00fbf0; ?>
The above is PHP Three ways to redirect pages in .
Recommended learning: php video tutorial
The above is the detailed content of How to redirect web pages in PHP. For more information, please follow other related articles on the PHP Chinese website!