Home >Backend Development >PHP Tutorial >url拼接有没有函数可以直接完成的?

url拼接有没有函数可以直接完成的?

WBOY
WBOYOriginal
2016-06-06 20:40:401346browse

array(
'url' => '111',
'desc' => '123',
'type' => 'share',
'showcount' => '',
);
转换成:
url=111&desc=123&type=share&showcount=

回复内容:

array(
'url' => '111',
'desc' => '123',
'type' => 'share',
'showcount' => '',
);
转换成:
url=111&desc=123&type=share&showcount=

<code>$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

</code>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn