$url = 'https://api.weixin.qq.com/cgi-bin/message/wxopen/updatablemsg/send?access_token=' . $token [ 'data' ]->access_token; $post_data = array ( "activity_id" => $actId , "target_state" =>( count ( $openids )>= $max ?1:0), "template_info" => array ( "parameter_list" => array ( array ( 'name' => 'member_count' , 'value' => count ( $openids )), array ( 'name' => 'room_limit' , 'value' => $max ), array ( 'name' => 'path' , 'value' => '?actId=' . $actId ), array ( 'name' => 'version_type' , 'value' => 'develop' ) ) ) ); $ch = curl_init(); $j = json_encode( $post_data ); curl_setopt( $ch , CURLOPT_HTTPHEADER, array ( 'Content-Type: application/json' , 'Content-Length: ' . strlen ( $j ))); curl_setopt( $ch , CURLOPT_URL, $url ); curl_setopt( $ch , CURLOPT_RETURNTRANSFER, TRUE); curl_setopt( $ch , CURLOPT_POST, 1); curl_setopt( $ch , CURLOPT_POSTFIELDS, $j ); $result = curl_exec( $ch ); echo json_encode( $result ); curl_close( $ch ); |
为什么死活提示post数据为空?
。。。。自己解决了,member_count和room_limit的value不能为数字...要转成字符....不然提示44002(post数据为空错误)....我砸,这明明不是数据为空的问题,干嘛提示44002,坑死了,误导....