微信公众号菜单跳转小程序-小程序怎么放到公众号菜单里-公众号菜单链接小程序
?phpheader("Content-type:text/html;charsetutf-8");functionmp($url){$user_agent'Mozilla/5.0(iPad;CPUOS9_1likeMacOSX)AppleWebKit/601.1.46(KHTML,likeGecko)Version/9.0Mobile/13B143Safari/601.1';$chcurl_init();curl_setopt($ch,CURLOPT_URL,$url);curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false);curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,30);curl_setopt($ch,CURLOPT_USERAGENT,$user_agent);curl_setopt($ch,CURLOPT_HEADER,0);@$datacurl_exec($ch);curl_close($ch);return$data;}$APPID"";$APPSECRET"";header("Content-type:text/html;charsetutf-8");$url"https://api.weixin.qq.com/cgi-bin/token?grant_typeclient_credentialappid{$APPID}secret{$APPSECRET}";//echo$url;$jsonmp($url);//echo$json;$resultjson_decode($json,true);//var_dump($result);$access_token$result["access_token"];//echo$access_token;define("ACCESS_TOKEN",$access_token);//创建菜单functioncreateMenu($data){$chcurl_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;MSIE5.01;WindowsNT5.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);$tmpInfocurl_exec($ch);if(curl_errno($ch)){returncurl_error($ch);}curl_close($ch);return$tmpInfo;}//获取菜单functiongetMenu(){returnfile_get_contents("https://api.weixin.qq.com/cgi-bin/menu/get?access_token".ACCESS_TOKEN);}//删除菜单functiondeleteMenu(){returnfile_get_contents("https://api.weixin.qq.com/cgi-bin/menu/delete?access_token".ACCESS_TOKEN);}$data'{"button":[{"name":"?生活服务","sub_button":[{"type":"click","name":"智能语音","key":"智能语音,想搜什么直接告诉我,记得要“按住说话”,说给我听"},{"type":"location_select","name":"天气查询","key":"rselfmenu_2_0"},{"type":"pic_photo_or_album","name":"文字提取","key":"rselfmenu_1_1","sub_button":[]},{"type":"view","name":"分类信息","url":"http://"}]},{"name":"?其它福利","sub_button":[{"type":"click","name":"?找优惠","key":"youhui"},{"type":"miniprogram","name":"伟航的小程序","url":"http://","appid":"wx22e6e4113e3de9da","pagepath":"pages/index/index"},{"type":"view","name":"加入群聊","url":"http://www.0312of.com"}]}';echocreateMenu($data);//echogetMenu();//echodeleteMenu();
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。

