This action will force synchronization from 宇润/YurunOAuthLogin, which will overwrite any changes that you have made since you forked the repository, and can not be recovered!!!
Synchronous operation will process in the background and will refresh the page when finishing processing. Please be patient.
YurunOAuthLogin是一个PHP 第三方登录授权 SDK,集成了QQ、微信、微博、Github等常用接口。可以轻松嵌入支持 PHP >= 5.4 的任何系统中,2.0 版现已支持 Swoole 协程环境。
我们有完善的在线技术文档:http://doc.yurunsoft.com/YurunOAuthLogin
API 文档:https://apidoc.gitee.com/yurunsoft/YurunOAuthLogin
宇润PHP全家桶群:17916227 ,如有问题会有人解答和修复。
大家在开发中肯定会对接各种各样的第三方平台,我个人精力有限,欢迎各位来提交 PR (码云/Github),一起完善它,让它能够支持更多的平台,更加好用。
后续将不断添加新的平台支持,也欢迎你来提交PR,一起完善!
在您的composer.json中加入配置:
{
"require": {
"yurunsoft/yurun-oauth-login": "~2.0"
}
}
自v1.2起所有方法统一参数调用,如果需要额外参数的可使用对象属性赋值,具体参考test目录下的测试代码。
下面代码以QQ接口举例,完全可以把QQ字样改为其它任意接口字样使用。
$qqOAuth = new \Yurun\OAuthLogin\QQ\OAuth2('appid', 'appkey', 'callbackUrl');
$url = $qqOAuth->getAuthUrl();
$_SESSION['YURUN_QQ_STATE'] = $qqOAuth->state;
header('location:' . $url);
// 获取accessToken
$accessToken = $qqOAuth->getAccessToken($_SESSION['YURUN_QQ_STATE']);
// 调用过getAccessToken方法后也可这么获取
// $accessToken = $qqOAuth->accessToken;
// 这是getAccessToken的api请求返回结果
// $result = $qqOAuth->result;
// 用户资料
$userInfo = $qqOAuth->getUserInfo();
// 这是getAccessToken的api请求返回结果
// $result = $qqOAuth->result;
// 用户唯一标识
$openid = $qqOAuth->openid;
// 解决只能设置一个回调域名的问题,下面地址需要改成你项目中的地址,可以参考test/QQ/loginAgent.php写法
$qqOAuth->loginAgentUrl = 'http://localhost/test/QQ/loginAgent.php';
$url = $qqOAuth->getAuthUrl();
$_SESSION['YURUN_QQ_STATE'] = $qqOAuth->state;
header('location:' . $url);
\Yurun\Util\YurunHttp::setDefaultHandler('Yurun\Util\YurunHttp\Handler\Swoole');
开源不求盈利,多少都是心意,生活不易,随缘随缘……
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。