(1) Function
The role of the http_build_query() function is to use the given array of associations (or subscripts) to generate a URL-encoded request string.
(2) Grammar
写法格式:http_build_query ( mixed $query_data [, string $numeric_prefix [, string $arg_separator [, int $enc_type = PHP_QUERY_RFC1738 ]]] )
(3) Cases
For example:
<?php $user = array('name' => 'Tony', 'age' => 23); $userInfo = http_build_query($user); echo $userInfo; ?>
Our output can get: name=Tony&age=23
(4) Scene
What's the use of this, this is to simulate an http request, and pass the obtained data through the function URL-encode, which is generally used in callbacks.