收藏
回答

小程序订阅信息的发送报错47001?请高手指点,感谢支持,我在此社区查过此问题无解。

$url = "https://api.weixin.qq.com/cgi-bin/message/wxopen/template/uniform_send?access_token=" . $tobkSTr;
$rawPost = [
   "touser" => $appopenid,
   "template_id"  => "uSznBNtSI_cNBdJ2C0Xem5Brm4mbdzbv2X2xw",
   "miniprogram_state" =>"developer",

   "data" => [

      "name2" => ["value" => "是"],
      "phrase1" => ["value" => "人"]
   ]
];

$result = $this->m_post($url, $rawPost);
以下是php
function m_post($url , $jsonStr ) {

   $type='json';
   $ch = curl_init();
   if($type=='json'){//json $_POST=json_decode(file_get_contents('php://input'), TRUE);
      $headers = array("Content-type: application/json;charset=UTF-8","Accept: application/json","Cache-Control: no-cache", "Pragma: no-cache");
      $data=json_encode($jsonStr);
   }
   $curl = curl_init();
   curl_setopt($curl, CURLOPT_URL, $url);
   curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
   curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
   if (!empty($data)){
      curl_setopt($curl, CURLOPT_POST, 1);
      curl_setopt($curl, CURLOPT_POSTFIELDS,$data);
   }
   curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
   curl_setopt( $ch, CURLOPT_HTTPHEADER, $headers );
   $output = curl_exec($curl);
   curl_close($curl);
   return $output;
}



 错误信息如下:errcode":47001,"errmsg":"data format error hint: [oI85901954963]"

在线等.....
最后一次编辑于  2020-02-13
回答关注问题邀请回答
收藏

3 个回答

登录 后发表内容
问题标签