Home >Backend Development >PHP Problem >How to convert php url to array
php url to array method: first get the url string; then parse the query string into variables through the parse_str function, and store the variables into an array; finally print out the converted value through "var_dump" Just an array.
Recommended: "PHP Video Tutorial"
Convert the string of URL with & into an array
For example:
$str = "title=我是小白&name=真的很白&text=但是决不放弃"; parse_str($str, $res); //第一个参数为字符串,第二个参数为结果 var_dump($res); exit;
The above is the detailed content of How to convert php url to array. For more information, please follow other related articles on the PHP Chinese website!