douliexu5623
2015-03-03 08:11
浏览 30

在PHP中读取哈希参数

me jQuery generate url:

location.hash = "parameter1=DEF&parameter2=XYZ";
//www.example.com#parameter1=DEF&parameter2=XYZ

How to read this parameter1 and parameter2 in PHP

图片转代码服务由CSDN问答提供 功能建议

me jQuery generate url:

  location.hash =“  parameter1 = DEF& parameter2 = XYZ“; 
 // www.example.com#parameter1 = DEF& parameter2 = XYZ 
   
 
 

如何阅读 PHP中的parameter1 parameter2

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • douhe6255 2015-03-03 08:12
    已采纳

    Your javascript is client-side and your PHP is server-side, so it's not possible.

    You should rethink your application or use Ajax to send data from Javascript to PHP: https://api.jquery.com/jquery.ajax/

    打赏 评论
  • doucao1066 2015-03-03 08:20

    You can by using parse_url

    For e.g

    $url = 'http://google.com#anchor';
    
    print_r(parse_url($url));
    

    Will give you

    [fragment] = anchor
    
    打赏 评论

相关推荐 更多相似问题