VPS参考测评推荐
专注分享VPS主机优惠信息
衡天云优惠活动
华纳云最新优惠促销活动
jtti最新优惠促销活动

微信创建自定义目录的方法示例(微信创建自定义目录的方法示例图片)

locvps
主机参考:VPS测评参考推荐/专注分享VPS服务器优惠信息!若您是商家可以在本站进行投稿,查看详情!此外我们还提供软文收录、PayPal代付、广告赞助等服务,查看详情!
我们发布的部分优惠活动文章可能存在时效性,购买时建议在本站搜索商家名称可查看相关文章充分了解该商家!若非中文页面可使用Edge浏览器同步翻译!PayPal代付/收录合作

本文主要和大家分享一个微信如何创建自定义目录的例子,希望对你有所帮助。

//创建自定义菜单私有函数Create _ menu($ access _ token){//echo $ access _ token;退出;$ url = https://api.weixin.qq.com/cgi-bin/menu/create?访问令牌= .$ access _ token$ post _ data = # 39{ 按钮 :[{ ;名称 : PHP , sub _ button :[{ ;键入 : 查看 , 名称 : ThinkPHP , url : http://WAP . PHP lee . com ;},{ 键入 : 查看 , 名称 : 微信”, url : http://wap.phplee.com/&; }]},{ 名称 : 操作和维护, ;sub _ button :[{ ;键入 : 查看 , 名称 : Linux , url : http://WAP . PHP lee . com ;},{ 键入 : 查看 , 名称 : MySQL , url : http://WAP . PHP lee . com ;} ] },{ 名称 : APP , sub _ button :[{ ;键入 : 查看 , 名称 : Android , url : http://wap.phplee.com/&; }、{ 键入 : 查看 , 名称 : IOS , url : http://wap.phplee.com/&; }]}]} # 39;;$ header[]= ;content -类型:application/JSON;charset = ut F-8 ;;$ ch = curl _ init();curl_setopt ( $ch,CURLOPT_URL,$ URL);//请求模式为post curl _ setopt ($ ch,curl opt _ custom request," POST );//禁用时,cURL将终止来自服务器的验证。curl _ setopt ($ ch,curl opt _ SSL _ verifypeer,false);//不检查证书curl _ setopt ($ ch,curl opt _ SSL _ verifyhost,false);//发送头字段curl _ setopt ($ ch,curl opt _ httpheader,$ header);//告诉对方自己的浏览器型号curl _ setopt ($ ch,curl opt _ user agent, # 39;Mozilla/4.0(兼容;MSIE 5.01windows NT 5.0) # 39;);//那意味着自动跳转抓取(如果URL被302重定向)并继续抓取curl _ setopt ($ ch,curl opt _ follow location,1);//自动重定向打开curl _ setopt ($ ch,curl opt _ autoreferer,1);//发送的post参数curl _ setopt ($ ch,curl opt _ postfields,$ post _ data);//得到的结果不在屏幕上显示,curl _ setopt ($ ch,curl opt _ return transfer,true)存储为变量结果;$ RES = curl _ exec($ ch);//如果操作错误,返回错误号$ flat = curl _ errno($ ch);if($ flat){ $ data = curl _ error($ ch);} curl _ close($ ch);//得到返回结果后,将json格式转换成可用的数组格式$res = json_decode ($res,true);if($RES[ # 39;错误代码 # 39;]==0){返回true}else{返回false}}使用:

//微信测试公共函数Index(){//Get access _ token if(S( # 39;访问令牌 # 39;)){ $ access _ token = S( # 39;访问令牌 # 39;);} else { $ access _ token = $ this - gt;get _ access _ token();s( # 39;访问令牌 # 39;,$ access _ token);}//echo $ access _ token;退出;//创建菜单$ result = $ this ->;create _ menu($ access _ token);if($ result = = = false){ echo # 39;菜单创建失败 # 39;;退出;} else { echo # 39菜单创建成功 # 39;;退出;}}以上是微信创建自定义目录的方法示例的详细内容。更多请关注主机参考其他相关文章!

这几篇文章你可能也喜欢:

本文由主机参考刊发,转载请注明:微信创建自定义目录的方法示例(微信创建自定义目录的方法示例图片) https://zhujicankao.com/80722.html

【腾讯云】领8888元采购礼包,抢爆款云服务器 每月 9元起,个人开发者加享折上折!
打赏
转载请注明原文链接:主机参考 » 微信创建自定义目录的方法示例(微信创建自定义目录的方法示例图片)
主机参考仅做资料收集,不对商家任何信息及交易做信用担保,购买前请注意风险,有交易纠纷请自行解决!请查阅:特别声明

评论 抢沙发

评论前必须登录!