php-地址栏输入与链接

有没有一种方法可以询问请求以确定导航方法?

(使用LAMP配置,PHP)

换句话说…我想知道条目是手动输入到地址栏中,还是使用了链接/书签.

解决方法:

您可以检查$_SERVER [‘HTTP_REFERER’]变量,该变量将包含此人所导航的URL.我不确定如果他们选择书签或手动输入URL会发生什么,尽管我怀疑此变量为空.

但是,正如the manual中所述:

The address of the page (if any) which referred the user agent to the current page. This is set by the user agent. Not all user agents will set this, and some provide the ability to modify HTTP_REFERER as a feature. In short, it cannot really be trusted.

上一篇:android-图像资源从react-native应用程序中消失


下一篇:在PHP中使用URL突出显示当前导航选项卡