且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

用PHP解析URL查询

更新时间:2023-02-23 17:21:20

您可以执行第二步,并使用

You can take the second step and parse the query string using parse_str.

$url = 'www.domain.org?x=1&y=2&z=3';
$url_parts = parse_url($url);
parse_str($url_parts['query'], $query_parts);
var_dump($query_parts);

我认为您的意思是查询字符串而不是片段,因为片段没有标准模式.

I assumed you meant the query string instead of the fragment because there isn't a standard pattern for fragments.