<?php class qqlogin{ public $app_id; public $app_key; public $callback; public $code; public $state; public function __construct($app_id,$app_key,$callback){ $this->code = isset($_REQUEST['code'])? $_REQUEST['code'] : ''; $this->state = isset($_REQUEST['state'])? $_REQUEST['state'] : ''; $this->app_id = $app_id; $this->app_key = $app_key; $this->callback = $callback; } public function get_token(){ $url = "https://graph.qq.com/oauth2.0/token?grant_type=authorization_code&client_id=".$this->app_id."&client_secret=".$this->app_key."&code=".$this->code."&redirect_uri=".urlencode($this->callback); $str = $this->visit_url($url); parse_str($str,$arr); return $arr; }
这是一个QQ登陆类,用于QQ登陆的界面,
php-qq登陆类,类已封装,用于QQ登陆的callback页面。 app_id,app_key,callback
qq接入流程需要自己去QQ互联文档上了解,此类只做回调功能封装。
请求URL地址,得到返回字符串,将字符串转换为可以进行json_decode的格式,通过curl取得页面返回值。
本站所有资源均由网友贡献或各大下载网站转载。请自行检查软件的完整性!本站所有资源仅供学习参考。请不要将它们用于商业目的。否则,一切后果由您负责!如有侵权,请联系我们删除。联系方式:admin@php.cn
相关文章

09Jun2020
由于腾讯oauth sdk写的太多,不能与thinkphp和好的结合,将腾讯oauth sdk写成tp的扩展类,在__construct方法中你可以直接写你的app_id、app_key和回调地址。

30Dec2024
大约一周前,我必须为网络开发人员的免费密码学课程构建一个登陆页面。当我开始构建它时,我一路收集了一些工具。 这些工具极大地帮助我使登陆页面比以前更加漂亮

21Nov2024
解决 UnsatisfiedLinkError: Can't Find Dependent Libraries in JNI Projects当开发 Java Native Interface (JNI) 项目时,您可能...

30Oct2019
phpmyadmin不显示登录页面解决方法:找到并打开phpMyAdmin\libraries\plugins\auth\AuthenticationCookie.class.php文件,将其中关于登录页面代码中的两处hide删除即可。

20Oct2024
phpMyAdmin 错误:“count():参数必须是实现可数的数组或对象”您是否遇到过 phpMyAdmin 错误,指出“./libraries/sql.lib.php#601\ncount() 中的警告:参数必须是数组或对象

19Oct2024
dacom.dll 在我的计算机上做什么? dacom.dll 是 Microsoft Corporation 创建的 Digital Anvil Component Libraries 使用的 DLL 文件。此过程仍在审核中。 dacom.dll 等非系统进程源自您安装的软件


Hot Tools
