Press "Enter" to skip to content

url 解析


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

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

$test = basename("http://localhost/index.php?name=tank&sex=1#top");
    echo $test;
结果如下 index.php?name=tank&sex=1#top
发表评论