我不确定在使用 cURL 时要使用什么编码:
得到:
邮政:
(POSTFIELDS=) 测试=测试 1
(POSTFIELDS=) 测试=测试+1
(POSTFIELDS=) 测试=测试%201
CURL 可以接受 post 的参数数组,它会为您处理编码:
$array = (
'test' => 'test 1',
);
curl_setopt($ch, CURLOPT_POSTFIELDS, $array);
Run Code Online (Sandbox Code Playgroud)
但是,根据 curl 文档(http://php.net/curl_setopt,搜索 CURLOPT_POST_FIELDS),对于 PHP,这些对应该采用以下urlencode()格式:
$post_args = urlencode('test=test 1');
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_args);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2554 次 |
| 最近记录: |