<?PHP//Parse_str and Http_build_query use//use PARSE_STR to convert a URL string to an array of Key=>value$str= "Tn=monline_dg&ie=utf-8&bs=httpbuildurl&f=3&rsv_bp=1&wd=php+buildquery&rsv_sug3=17 &rsv_sug4=330&rsv_sug1=16&oq=php+build&rsv_sug2=0&rsp=0&inputt=8922 "; Parse_str($str,$arr); Var_export($arr); /*output: Array (' tn ' = ' monline_dg ', ' ie ' = ' utf-8 ', ' bs ' = ' httpbuildurl ', ' f ' = ' 3 ', ' RSV_BP ' = ' 1 ', ' wd ' = ' php buildquery ', ' rsv_sug3 ' = ' + ', ' rsv_sug4 ' + ' + ', ' rsv_sug1 ' = ' 16 ', ' OQ ' + ' PHP build ', ' rsv_sug2 ' = ' 0 ', ' rsp ' = ' 0 ', ' inputt ' = ' 8922 ',)*/ //use Http_build_query to convert an array of key=>value into a URL string$url=Http_build_query($arr); Echo($url); //Output: tn=monline_dg&ie=utf-8&bs=httpbuildurl&f=3&rsv_bp=1&wd=php+buildquery&rsv_sug3= 17&rsv_sug4=330&rsv_sug1=16&oq=php+build&rsv_sug2=0&rsp=0&inputt=8922?>
To put it simply, Http_build_query () is converting an array into a URL question mark, followed by a parameter string, and is automatically urlencode processed.
PHP uses Http_build_query () to construct a URL string (the Post parameter group transformation can be stitched into a GET request link)