Home >Backend Development >PHP Tutorial >Three methods of PHP URL redirection (redirect)_PHP tutorial

Three methods of PHP URL redirection (redirect)_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:53:00748browse

[Use header() function]
PHP's HTTP-related functions provide a header() function. First of all, it must be clear that the header() function must be placed at the beginning of the PHP program, and no other header() function or setcookie() can be called before. If With web page output, this statement must be placed before the tag.

Use the following statement:

header("location: http://www.bibias.com");
exit;
?>

As long as this statement is executed, the web page will be automatically redirected to http://www.bibias.com


【Redirect using HTML tag】




if(isset($url))
{
echo "";
}
?>




CONTENT="5;url=$url" means that after 5 seconds, this webpage will automatically redirect to the address $url.


[Use js script to implement redirection]



$url="http://www.bibias.com";
echo "";
?>

I don’t have much time to understand in detail, so I prefer to use javascript
Author: Qingyi

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/478067.htmlTechArticle[Use header() function] PHP’s HTTP related functions provide a header() function. First of all, you must be clear , the header() function must be placed at the beginning of the php program, and there must be no other...
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