Http_build_query (PHP5) http_build_query & mdash; request string generated after URL-encode description stringhttp_build_query (array $ formdata [, string $ numeric_prefix]) use the given Association (or subscript) array to generate a URL-en
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. The formdata parameter can be an array or an object containing attributes. A formdata 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 base array and the numeric_prefix parameter is provided, 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.
2 |
Use arg_separator.output to separate parameters. |
01 |
Example #1 http_build_query () Example |
03 |
$ Data = array ('foo' => 'bar ', |
06 |
'Php' => 'HyperText processor '); |
08 |
Echo http_build_query ($ data); // foo = bar & baz = boom & cow = milk & php = hypertext + processor |
10 |
Example #2 http_build_query () use the following element of a number |
12 |
$ Data = array ('foo', 'bar', 'Baz', 'Boom ', 'cow' => 'milk ', 'php' => 'HyperText processor '); |
14 |
Echo http_build_query ($ data ); |
17 |
Echo http_build_query ($ data, 'myvar _'); |
Simply understand that the two functions parse_str are a url? After the parameters are converted to an array parse_str (url, arr) parse_url, a complete url is parsed into an array parse_url (string url) http_build_query, which is to convert an array to a url? The following parameter string will be automatically processed by urlencode string http_build_query (array formdata [, string numeric_prefix])