Home > php教程 > php手册 > php一行实现的URL转向代码

php一行实现的URL转向代码

WBOY
Release: 2016-06-21 09:05:04
Original
917 people have browsed it

十分低级,学半小时PHP就能做的出来.

引用:
$url=$_GET["url"];header("Location:"."http://".$url);?>
十分简单.自问自答.
带链接:http://bbs.blueidea.com/viewthread.php?tid=2853779
就是5楼的那种思路,回望此链接也是如此.文件名存为viewthread.php,变量名是tid,值是2853779,借用数据库调用出此值对应的内容.

代码拓展php5.2.0有效

引用:

$url=$_GET["url"];
  if (strlen($url >= '3')){
    header("Location:"."http://".$url);
}
?>
实现当变量值字符数小于三位时,因为再短的域名地址如g.cn也有三位,所以就不跳转,可以显示任意内容.

但愿有菜鸟能用的上,至少我是用的上了~



Related labels:
source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template