Home > Backend Development > PHP Tutorial > 写一个php文件 比如 baidu.com/a.php?url=google.com 会立即跳转到google,该如何处理

写一个php文件 比如 baidu.com/a.php?url=google.com 会立即跳转到google,该如何处理

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 11:12:36
Original
923 people have browsed it

写一个php文件 比如 baidu.com/a.php?url=google.com 会立即跳转到google
写一个php文件 比如 baidu.com/a.php?url=google.com 会立即跳转到google


------解决方案--------------------
a.php

$url = $_GET['url'];
if(!empty($url)) header('location:http://' . $url);
exit;

?>

a.php?url=amysql.com



这样做要注意一点就是,别被别人利用拉,跳到一些不和谐的网站
------解决方案--------------------
<br /><?php<br />$url=$_GET[url];<br />header("Location:http://".$url);<br />?><br />
Copy after login

------解决方案--------------------
<br />  $url = urldecode($_GET[url]);<br />  header("Location:http://".$url);<br />
Copy after login
Related labels:
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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template