How to detect the site a user came from before mine in PHP?

前端 未结 6 1938
温柔的废话
温柔的废话 2020-12-07 02:38

How can I detect the site the user came from before accessing mine in PHP?

6条回答
  •  攒了一身酷
    2020-12-07 03:18

    Try this:

    $_SERVER['HTTP_REFERER']
    

    For more information, please see HTTP referrer:

    The referrer, or HTTP referrer—also known by the common misspelling referer that occurs as an HTTP header field—identifies, from the point of view of an internet webpage or resource, the address of the webpage (commonly the URL, the more generic URI or the i18n updated IRI) of the resource that links to it. By checking the referrer, the new page can see where the request came from.

提交回复
热议问题