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_query? (? Array? $ Formdata? [,? String? $ Numeric_prefix?]) 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_');
?>
========================================================== ========================================================== ========
A simple understanding of these two functions
Parse_str is a url? The following parameters are converted into an array.
Array parse_str (url, arr)
Parse_url parses a complete url into an array.
Array parse_url (string url)
Http_build_query is to convert an array into a url? The parameter string that follows will be automatically processed by urlencode.
String http_build_query (array formdata [, string numeric_prefix])
No key or subscript is specified for the array.