Home >Backend Development >PHP Tutorial >Three methods of PHP URL redirection (redirect)_PHP tutorial
[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
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】
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