向https提交post数据的问题,{"errcode":40016,"errmsg":"invalid button size"}

微信开发时向https提交post数据的问题

系统显示:{"errcode":40016,"errmsg":"invalid button size"}

找好好久终于找到可以正常跑的代码了:

$data = ' {
			 "button":[
			 {	
				  "type":"click",
				  "name":"今日歌曲",
				  "key":"V1001_TODAY_MUSIC"
			  },
			  {
				   "type":"click",
				   "name":"歌手简介",
				   "key":"V1001_TODAY_SINGER"
			  },
			  {
				   "name":"菜单",
				   "sub_button":[
				   {	
					   "type":"view",
					   "name":"搜索",
					   "url":"http://www.soso.com/"
					},
					{
					   "type":"view",
					   "name":"视频",
					   "url":"http://v.qq.com/"
					},
					{
					   "type":"click",
					   "name":"赞一下我们",
					   "key":"V1001_GOOD"
					}]
			   }]
		 }';

		 $ch = curl_init();
		 curl_setopt($ch, CURLOPT_URL, "https://api.weixin.qq.com/cgi-bin/menu/create?access_token=".$access_token);
		 curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
		 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
		 curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
		 curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; MSIE 5.01; Windows NT 5.0)');
		 curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
		 curl_setopt($ch, CURLOPT_AUTOREFERER, 1);
		 curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
		 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
		 $tmpInfo = curl_exec($ch);
		 if (curl_errno($ch)) {
		  echo curl_error($ch);
		 }
		
		 curl_close($ch);
		  
		echo $tmpInfo; 



你可能感兴趣的:(PHP)