获取最后访问的页面 [英] Get last page visited

查看:74
本文介绍了获取最后访问的页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要知道访问我网站的人是否来自另一个特定网站. 示例:

I need to know if a person that comes to my website went from an another specific website. Example:

  • 用户A访问www.youtube.com/myvideo并单击指向我的网站的链接.
  • 用户B访问google,搜索我的网站,然后单击链接.

我的页面上的结果消息:

Results Message on my page:

  • 用户A:Welcome! You already know how it works, register now!
  • 用户B:Welcome! Please watch our video first at www.youtube.com/myvideo
  • User A: Welcome! You already know how it works, register now!
  • User B: Welcome! Please watch our video first at www.youtube.com/myvideo

我的问题是:

  1. 在进入我的页面之前是否可以知道用户访问的最后一个URL?
    我已经使用PHP尝试了$_SERVER['HTTP_REFERER'],但是它不能正常工作,并且我读到它不适用于所有浏览器.
  2. 是否存在任何语言或PHP脚本来获取此网址,并且可以在所有浏览器上正常工作?
  1. Is it possible to know the last url the user visited before entering my page?
    I already tried $_SERVER['HTTP_REFERER'] with PHP, but it's not working correctly and I read that does not work on all browsers.
  2. Is there any language or php script to get this url, working on all browser correctly?

推荐答案

HTTP引用标头是唯一的方法.这是通过$_SERVER['HTTP_REFERER']在PHP中提供给您的数据.

The HTTP referer header is the only way. This is the data that is given to you in PHP via $_SERVER['HTTP_REFERER'].

请注意,此标头在大多数情况下均可使用.另外请注意,它很容易被欺骗.

Note that this header will work in most cases. Also note that it can be easily spoofed.

这篇关于获取最后访问的页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆