Home > Backend Development > PHP Tutorial > php判断url发源

php判断url发源

WBOY
Release: 2016-06-13 12:25:58
Original
1119 people have browsed it

php判断url来源
问:除了用$_SERVER['HTTP_REFERER']来判断

还有没其它什么办法.判断上一个url的来源.
------解决思路----------------------
HTTP_REFERER 是传入的 CGI 环境变量,并不总是存在
浏览器地址栏访问时就没有,客户端也可控制不发出

使用 $_SERVER['HTTP_REFERER'] 时需先判断他有没有
if(isset($_SERVER['HTTP_REFERER'])) {
  //echo $_SERVER['HTTP_REFERER'];
}
------解决思路----------------------
php 只有HTTP_REFERER来判断。
但如果是直接访问页面,是没有HTTP_REFERER的,所以需要判断
if(isset($_SERVER['HTTP_REFERER'])){
    echo $_SERVER['HTTP_REFERER'];
}

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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template