0
我想知道是否有可能让别人只能输入链接:PHP内嵌URL重定向?
并让它在人们访问时真正进入真正的链接。
这是我的,但我不知道如何实现。
<?php
if($_GET["k"] == "custom") header("Location: {$_POST["first"]}_{$_POST["last"]}");
$file = fopen("link.php", "r");
$data = fread($file, filesize("link.php"));
$first = $_GET["n"];
$last = fixN($last);
$data = str_replace("first", ucfirst(strtolower($first)), $data);
$data = str_replace("last", ucfirst($last), $data);
print $data;
}
?>
在页面上;
<BODY onLoad="first">
即使你做链接,它也不会只抓住最后一部分。这是我需要它重定向到。
<?php
if (isset($_SERVER['REQUEST_URI'])) AND filter_var(trim($_SERVER['REQUEST_URI']), FILTER_VALIDATE_URL)) {
header('Location: ' . $_SERVER['REQUEST_URI']);
}
?>
<html>
<head></head>
<body>
<a href="first">first</a>
</body>
</html>
这是确切的链接http://LikeTreasure.com/google.com
我不知道什么是错。
即使您指定的文件类型http://LikeTreasure.com/file.html
它似乎总是发送整个URL。