1 回复
问题解决了,原来封装的方法不行重新封装了一个。
/**
* [@param](/user/param) $data
* 提交数据
* [@param](/user/param) $post_url
* 提交链接
* [@return](/user/return) bool|string
*/
function WeChatPOST($data, $post_url)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $post_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data, JSON_UNESCAPED_UNICODE));
$r = curl_exec($ch);
curl_close($ch);
return $r;
}