How to explode URL parameter list string into paired [key] => [value] Array? [duplicate]
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Parse query string into an array How can I explode a string such as: a=1&b=2&c=3 So that it becomes: Array { [a] => 1 [b] => 2 [c] => 3 } Using the regular explode() function delimited on the & will separate the parameters but not in [key] => [value] pairs. Thanks. 回答1: Use PHP's parse_str function. $str = 'a=1&b=2&c=3'; $exploded = array(); parse_str($str, $exploded); $exploded['a']; // 1 I wonder where you get