且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

PHP:如何获取引荐来源网址?

更新时间:2023-11-27 19:12:04

$_SERVER['HTTP_REFERER']将为您提供引荐来源页面的URL(如果存在).如果用户使用书签或通过手动输入URL直接访问您的网站,则http_referer将为空.同样,如果用户以编程方式(CURL)发布到您的页面,则他们也没有义务设置http_referer.您错过了所有_,是错字吗?

$_SERVER['HTTP_REFERER'] will give you the referrer page's URL if there exists any. If users use a bookmark or directly visit your site by manually typing in the URL, http_referer will be empty. Also if the users are posting to your page programatically (CURL) then they're not obliged to set the http_referer as well. You're missing all _, is that a typo?