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{“button“:【{“name“:“PHP“、“sub _ button“:【{“type“:“view“、“name“:“ThinkPHP“、“url“:“http://WAP . PHP lee . com“}、{“type“:“view“、“name“:“微信“、“URL“:“http://WAP . PHP lee . com/“}】}、{“name“:“运维“、“sub _ button“:【{“type“:“view“、“name“:“Linux“、“URL“;$ header【】=“content -type: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 _ set opt($ ch,Curl opt _ SSL _ VerifyPeer,false);//不检查证书curl _ setopt($ ch,curl opt _ SSL _ verify host,false);//发送头字段curl _ setopt($ ch,curl _ http header,$ 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 _ set opt($ ch,curl opt _ auto referrer,1);//发送post参数curl _ setopt($ ch,curl opt _ postfields,$ post _ data);//得到的结果不显示在屏幕上,作为变量结果存储在curl _ set opt($ 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){ return true;}else{返回false}}使用:

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

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

本文由主机参考刊发,转载请注明:微信如何创建自定义目录的示例(微信如何创建自定义位置) https://zhujicankao.com/105633.html

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

评论 抢沙发

评论前必须登录!