如何在PHP脚本中检测带有锚标记的REQUEST_URI ALONG [英] How to detect the REQUEST_URI ALONG WITH ANCHOR TAG in a php script

查看:70
本文介绍了如何在PHP脚本中检测带有锚标记的REQUEST_URI ALONG的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的一个脚本被称为

script.php?l = addr#anchor

我发现,使用SESSION [REQUEST_URI] QUERY_STRING ,可以得到 script.php?l = addr

I found, using SESSION [REQUEST_URI] or QUERY_STRING, gives script.php?l=addr

是否也可以使用php获取 #anchor ?

Is there a way to get the #anchor too using php?

预先感谢

推荐答案

锚通常不在服务器端可用.它是浏览器的指南. 如果您真的想知道锚是什么,并且可以控制该站点,则可以在URL的末尾添加& anchor = anchor.

The anchor is not usually available serverside. It is a guide to the browser. If you really want to know what anchor is called, and you have control of the site you can add &anchor=anchor at the end of your url.

如果您无法控制脚本的调用位置,那么我认为您没有太多机会.

If you don't have control of the place where your script is called, I don't think you have much of a chance.

关于以下帖子: 确实可以使用parse_url()检索给定URL的锚点部分. 这里的问题是您无法从php访问完整的URL(包括锚).

Regarding the post below: It is true that you can use parse_url() to retrieve the anchor part of a given url. The issue here is that you do not have access to the full url ( including anchors ) from php.

这篇关于如何在PHP脚本中检测带有锚标记的REQUEST_URI ALONG的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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