Home  >  Article  >  Backend Development  >  php URL跳转代码 减少外链_php实例

php URL跳转代码 减少外链_php实例

WBOY
WBOYOriginal
2016-06-07 17:25:49781browse

URL跳转代码
1.代码:
$url=$_GET["url"];header("Location:"."http://".$url);?> 如保存为aaa.php,可以实现aaa.php?url=www.baidu.com跳转到百度的效果.
这个简单的调用了默认的$_GET变量.以及php默认跳转Location:

2.实例升级:增加if循环
代码:

复制代码 代码如下:


$url=$_GET["url"];
if (strlen($url >=3)){
header("Location:"."http://".$url);
}
?>


URL转向页








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