$array =array (
‘id‘
=123,
‘name‘
=
‘dopost‘
);
echo http_build_query( $array );
//得到结果
id=123name=dopost
举例子如下: 复制代码 代码如下: $url = "http://www.electrictoolbox.com/php-extract-domain-from-full-url/"; $parts = parse_url($url); 输出: 复制代码 代码如下: Array ( [scheme] => http [host] => www.electrictoolbox.com [path] => /php-extract-domain-from-full-url/ ) 又如: 复制代码 代码如下: <?php $url = ‘http://username:[email protected]/path?arg=value#anchor‘; print_r(parse_url($url)); echo parse_url($url, PHP_URL_PATH); ?> 输出: 复制代码 代码如下: Array ( [scheme] => http [host] => hostname [user] => username [pass] => password [path] => /path [query] => arg=value [fragment] => anchor )
时间: 2024-10-12 14:23:21