这是我的阵列:
$url_parameter = Array ( 'country' => 'USA', 'city' => 'WDC', 'from' => 'Japan' );
我想将其转换为输出:
country=USA&city=WDC&from=Japan
有没有简单的代码来执行此任务?
答案 0 :(得分:2)
$url_parameter = Array ( 'country' => 'USA', 'city' => 'WDC', 'from' => 'Japan' );
echo http_build_query($url_parameter) . "\n";
echo http_build_query($url_parameter, '', '&');