http_build_query没有正确编码我的帖子字段

时间:2017-04-07 15:09:47

标签: php

这是我面临的一个奇怪问题。这是我发送的CURL请求:

    $fields = array(
        'action' => 'json',
        'region' => '',
        'states' => array('TX'),
        'start' => '4/2/2010',
        'end' => '4/2/2017',
        'internalcomments' => 'no'
    );
    $fields_string = http_build_query($fields);

    $ch = curl_init($url);
    curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch,CURLOPT_POST, count($fields));
    curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
    $jsonResult = curl_exec($ch);
    curl_close($ch);

但是,当我打印出$fields_string的内容时,我在查询字符串中看到了一个商标图标:

action=json®ion=&states%5B0%5D=AL&states%5B1%5D=TX&start=04%2F01%2F2010&end=04%2F07%2F2017&internalcomments=no

注意json这个词之后的®图标?知道它来自何处?

0 个答案:

没有答案
相关问题