如何在PHP中的#之后获取URL的锚点部分 [英] How to obtain anchor part of URL after # in php

查看:276
本文介绍了如何在PHP中的#之后获取URL的锚点部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的项目中使用LightBox机制时,我得到了一个URL http://nhs/search-panel.php#?Patientid = 2 我需要通过GET机制从中收集该Patientid,这在PHP中可能吗?

While using LightBox mechanism in my project I got an URL http://nhs/search-panel.php#?patientid=2 I need to collect that patientid from this through GET mechanism, Is that possible in PHP?

推荐答案

简单地说:不能!浏览器不会在其请求中将片段(哈希标记后的URL部分)发送给服务器.您必须依靠一些客户端javascript:也许您可以在使用URL之前重写URL.

Simply put: you can't! Browsers don't send the fragment (the part of the URL after the hashmark) in their requests to the server. You must rely on some client-side javascript: perhaps you can rewrite the url before using it.

这篇关于如何在PHP中的#之后获取URL的锚点部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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