VPS参考测评推荐
专注分享VPS主机优惠信息
衡天云优惠活动
新天域互联优惠活动
wexlayer优惠活动

详细说明微信官方帐户网页的批准说明(登录以进行官方帐户批准是否存在问题)

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

在这个移动时代,微信的公共帐户已成为人们获取信息并逐渐培养潜在客户的一种方式。因此,许多程序员已改用微信发展。因此,今天我们将向您展示如何在开发微信公共帐户的开发中实施网页批准。

在此之前,我们提供了一个函数来自定义接口以进行请求。以下示例代码使用请求接口请求接口:

函数是要求接口启动请求,传递参数并返回接口返回的数据。 (对于此而言,代码并不多。 curllopt_ssl_verifypeer,false);    curl_setopt($ ch,curlopt_returntransfer,true);                                                                                                                                                              �Error:.curl_error($ ch);      出口;   } curl_close($ ch);     返回$ res;}

(用于文章接口由Tencent提供。 您可以参考微信公共平台的开发人员文档)

1。首先,您需要配置官方帐户

1。在微信式公共帐户可以请求用户的网页批准之前,开发人员必须转到“开发- Web Services - Web帐户- Web Fark - Web Web Authentication的配置选项。 请注意,域名(字符串)是在此处而不是在URL中输入的。因此,请勿添加协议标题,例如http://。

2。身份验证回调的域名配置规范是完整的域名。例如,需要网页批准的域名是www.qq.com。配置后,此域名下的页面都可以在http://www.qq.com/music.html和http://wwwww.qq.com/login.html上执行OAuth2.0身份验证。 但是,http://pay.qq.com,http://music.qq.com,http://qq.com无法执行OAuth2.0 Authentication

3。第三方可以代表其官方帐户实施网页批准。 2。用户同意批准和检索代码接口地址:https://open.weixin.qq.com/connect/oauth2/authorize?appid=Appid=Appid=Appid=Appid&recrect = ri = ri = ri = recrect_uri&resect_uri&respense_typecons_type = code = code = codecope = scope = scopecope&cpppecope =

函数get_code()//获取代码/condruction请求请求地址$ code_url = https://open.weixin.qq.com/connect/oauth2/authorize?appid = wechat官方帐户appid appid appid appid Rdirect_uri =回调ressons response_type =代码范围= snsapi_userinfo state = state #wechat_redirect // redirect // redirect // redirect使用file_get_content()请求接口,因为您需要设置该州的回调地址。 标头(位置:。$ code_url);退出;}

3。使用您获得的代码,或使用access_token和openID

接口:https://api.weixin.qq.com/sns/oauth2/oauth2/oauth2/aaccess_token2/access_token获得的代码 *appid或secretfunction getAccess_token($代码)$ get_access_token_url。 $ res = http_url($ get_access_token_url);返回json_decode($ res,true);}

iv。 确定是否启用了access_token

接口:https://api.weixin.qqc.com/sns/auth?access_token = access_token&openID&openID = OpenID = openID

/***access_token启用函数ckeckacestoken($ access_token,$ openID)$ check_url = https://api.weixin.qqq.com/sns/auth?access_token = $$$$$    $ result = json_decode($ res,true);    if(isset($ result ['errmsg'])$结果['errmsg'] == 1){? appid = appid&grant_type = refresh_token&revresh_token_token = revresh_token

/*** access_token如果retieving_token无效https://api.weixin.qq.com/sns/oauth2/refresh_token? appid = appid grant_type = refresh_tokenrefferey_token = $ reFresh_token $ res = http_url($ get_refresh_token_url); return json_decode($ res,true);}

vi。获取用户信息

接口:https://api.weixin.qq.com/sns/userinfo?access_token = access_token&openID&openID&openID = openID&lang&lang = zh_cn

/********************************************************************************************************************************* https://api.weixin.qqc.com/sns/userinfo?access_token= $ aaccess_token openID = $ openID lang = zh_cn $ res = http_url($ get_user_info);                  国家/地区:国家/地区:http://thirdwx.qlogo.cn/mmopen/g3monuztnhkdmzicilibx6iafqac56vxlsufpb6n5wksyvyvy0wksyvy0chqssyvy0chqkkiajsgqkkkiajsgqq1dzutogvlrrrrrrrrrrhjberq4emsv84e emsv84e emsv84e ,,ilege:[privilege1 privilege2],unionId:o6_bmasdasdasd6_2sgvt7hmzopfl}

完整代码下面:

? php //第三方页面跳跃获取基本用户信息//这是请求页和代码会话的回调页面。 //如果要启动会话($ _get [#39;代码#39;])){//确定是否发送代码。 //使用代码获取Access_Token和OpenID,如果(ckeckacestoken($ res [#39; access_token),$ borts#39;])== 0){//确定access_token是否有效。 //获取用户信息$ _session [#39; userInfo“] = $ userInfo; //在会话中保存用户信息$ next_url =#39; http://web/web/index.php#39; //下一页地址header(位置:。t_code();函数get_code()//获取代码{$ code_url = https://open.weixin.qq.com/connect/oauth2/authorize?appid=Appid=Appid=Appid=Appid=Appid redirect_uri = callback redake_type_type_type = code = code = snsapi_userininfo state = snsapi_userininfo state = state = state = wechat_echat_rediriririririr(exitect_rediririririr(exitect_rediririr) getAccess_token($ code){$ get_access_token_url = https://api.weixin.qq.com/sns/oauth2/oauth2/access_token?appid = appid = secret = secret = $ code grant_type grant_type grant_dep_type return json_decode( {$ check_url = https://api.weixin.qqc.com/sns/auth?access_token = $ aces_tokenid = $ openID $$ res = http_url($ chect_url)9; errmsg#39;] == 1){返回1; // access_token有效} else {return 0; // access_token无效 *如果获得的access_token无效,请更新access_token函数getRefresh_token($ refresh_token){$ get_refresh_ttps_url = https://api.weixin.qucc.com/sns/sns/oauth2/re reblesh_token? appid = apphid_token_token_token_token $ res = http_url($ get_refresh_token_url);返回json_decode($ res,true); *基本用户信息功能get_user_info($ access_token,$ openID){$ get_user_info = https://api.weixin.qq.com/sns/sns/sns/userinfo?access_token= $请求接口功能,如果$数据为空,如果$数据有一个值,则post request函数http_url($ url,$ data = null){$ ch = curl_init();_ verifypeer,false); curl_setopt($ ch,curlopt_ssl_verifyHost,0); curl_setopt($ ch,curlopt_returntransfer,true); if(!empty($ data)){curl_setopt($ ch,curlopt_post,1); curl_setopt($ ch,curlopt_postfields,$ data); $ res = curl_exec($ ch); if(curl_errno($ ch)){echo错误:.curl_error($ ch);出口; curl_close($ ch);返回$ res。 }

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

本文由主机参考刊发,转载请注明:详细说明微信官方帐户网页的批准说明(登录以进行官方帐户批准是否存在问题) https://zhujicankao.com/146007.html

【腾讯云】领8888元采购礼包,抢爆款云服务器 每月 9元起,个人开发者加享折上折!
打赏
转载请注明原文链接:主机参考 » 详细说明微信官方帐户网页的批准说明(登录以进行官方帐户批准是否存在问题)
主机参考仅做资料收集,不对商家任何信息及交易做信用担保,购买前请注意风险,有交易纠纷请自行解决!请查阅:特别声明

评论 抢沙发

评论前必须登录!