Home >Backend Development >PHP Tutorial >PHP URL jump code to reduce external links
URL jump code
1. Code:
$url=$_GET["url"];header("Location:"."http://".$url);?> If saved as aaa .php, which can achieve the effect of aaa.php?url=www.baidu.com jumping to Baidu.
This simply calls the default $_GET variable. And php default jump Location:
2. Instance upgrade: increase if loop
Code:
Copy code The code is as follows:
$url=$_GET["url"];
if (strlen($url >=3)){
header("Location:"." http://".$url);
}
?>