build_http_query数组数组

时间:2012-12-17 04:10:45

标签: php arrays

我有简单的变量

$body = array(
        'content' => 'content test',
        'is_sanitize' => true,
        'sanitize_replacement' => '***',
        'meta' => array(
                    'name' => 'another',
                    'email' => 'another@email.com'
                )
    );

当我使用build_http_query($body)时,它会给我

content=content%20test&is_sanitize=1&meta=another&meta=another%40email.com&sanitize_replacement=%2A%2A%2A

问题是“名称”和“电子邮件”键的位置?为什么build_http_query不添加那些键?

由于

1 个答案:

答案 0 :(得分:2)

result应为:

content=content+test&is_sanitize=1&sanitize_replacement=%2A%2A%2A&meta%5Bname%5D=another&meta%5Bemail%5D=another%40email.com

注意:不是build_http_query而是http_build_query