Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个带有 URL 的字符串
$string = "http://www.yahoo.com/foo.php?bar=201";
我想要的只是查询字符串,没有其他内容。
显然不能用户 query_string,帮助表示赞赏。
$parts = parse_url($string); echo $parts['query'];
http://php.net/manual/en/function.parse-url.php