How to obtain anchor part of URL after # in php

后端 未结 4 1386
花落未央
花落未央 2020-12-02 01:13

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

4条回答
  •  广开言路
    2020-12-02 02:01

    If you check your server logs, you should see that no browser actually transmits the #anchor part of the URL the request, so you can't pick it up on the server side.

    If you need to know it, you'll need to write some Javascript to extract it from the document.location.href and send it to your server, either by turning it into a regular GET parameter and redirecting the user, or in the background with an XMLHttpRequest/AJAX.

提交回复
热议问题