首页 > 开发 > php > 正文

php 获取url锚点(hash)

2015-10-20 16:37:38  来源: 网友分享


$test = parse_url("http://localhost/index.php?name=tank&sex=1#top");
print_r($test);


结果如下

Array
(
 [scheme] => http //使用什么协议
 [host] => localhost //主机名
 [path] => /index.php //路径
 [query] => name=tank&sex=1 // 所传的参数
 [fragment] => top //后面根的锚点
)