网页外链转内链跳转

2022-12-08T21:32:00

一 新建PHP文件

比如 就叫go.php

<?php
$t_url=$_GET['url'];
if(!empty($t_url)) {
preg_match('/(http|https):\/\//',$t_url,$matches);
if($matches){
    $url=$t_url;
    $title='页面跳转中,请稍候...';
} else {
    preg_match('/\./i',$t_url,$matche);
    if($matche){
        $url='http://'.$t_url;
        $title='页面跳转中,请稍候...';
    } else {
        $url='/';
        $title='参数错误,正在返回首页...';
    }
}
} else {
$title='参数缺失,正在返回首页...';
$url='/';
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="refresh" content="1;url='<?php echo $url;?>';">
<title><?php echo $title;?></title>
</head>
</html>

二 添加链接

你的链接/go.php?url=需要跳转到的链接

完事

当前页面是本站的「Baidu MIP」版。发表评论请点击:完整版 »