Phphttp_build_query concatenate an array? Http_build_query (PHP5) http_build_query? -? Description of the request string after URL-encode is generated: string? Http_build_qu php http_build_query concatenation array
?
Http_build_query
(PHP 5)
Http_build_query? -? Request string generated after URL-encode
Description string?
Http_build_query? (? Array? $ Formdata? [,? String? $ Numeric_prefix?] )
Generate a URL-encode request string using the given correlated (or subscript) array. Parameter?Formdata? It can be an array or an object containing attributes. One?Formdata? An array can be a simple one-dimensional structure or an array composed of arrays (which can contain other arrays in turn ). If the numeric subscript is used in the basic array?Numeric_prefix? Parameter. The value of this parameter is used as the prefix of the numeric subscript element in the base array. This is to allow PHP or other CGI programs to obtain valid variable names when decoding data later.
Note:
Use? Arg_separator.output? To separate parameters.
Example #1?Http_build_query ()? Example
$data?=?array('foo'=>'bar',
??????????????'baz'=>'boom',
??????????????'cow'=>'milk',
??????????????'php'=>'hypertext?processor');
??????????????
echo?http_build_query($data);?//?foo=bar&baz=boom&cow=milk&php=hypertext+processor
?>
Example #2?Http_build_query ()? Use a number base element
$data?=?array('foo',?'bar',?'baz',?'boom',?'cow'?=>?'milk',?'php'?=>'hypertext?processor');
??????????????
echo?http_build_query($data);
?
echo?http_build_query($data,?'myvar_');
?>
========================================================== ========================================================== ========
Simply understand that the two functions parse_str are a url? The following parameters are converted into an array parse_str (url, arr)
Parse_url parses a complete url into an array parse_url (string url)
Http_build_query is to convert an array into a url? The following parameter string will be automatically processed by urlencode after string http_build_query (array formdata [, string numeric_prefix ]).