mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-08 15:42:48 +08:00
调整Oauth类的实例化参数
This commit is contained in:
@@ -12,7 +12,7 @@
|
|||||||
namespace Think;
|
namespace Think;
|
||||||
// oauth登录接口
|
// oauth登录接口
|
||||||
// <code>
|
// <code>
|
||||||
// Oauth::connect(['oauth_type'=>'qq','app_key'=>'','app_secret'=>'','callback'=>'','authorize'=>'']); // 链接QQ登录
|
// Oauth::connect('qq',['app_key'=>'','app_secret'=>'','callback'=>'','authorize'=>'']); // 链接QQ登录
|
||||||
// Oauth::login(); // 跳转到授权登录页面 或者 Oauth::login($callbackUrl);
|
// Oauth::login(); // 跳转到授权登录页面 或者 Oauth::login($callbackUrl);
|
||||||
// Oauth::call('api','params'); // 调用API接口
|
// Oauth::call('api','params'); // 调用API接口
|
||||||
// </code>
|
// </code>
|
||||||
@@ -28,18 +28,17 @@ class Oauth {
|
|||||||
/**
|
/**
|
||||||
* 连接oauth
|
* 连接oauth
|
||||||
* @access public
|
* @access public
|
||||||
|
* @param string $type Oauth类型
|
||||||
* @param array $options 配置数组
|
* @param array $options 配置数组
|
||||||
* @return object
|
* @return object
|
||||||
*/
|
*/
|
||||||
static public function connect($options=[]) {
|
static public function connect($type,$options=[]) {
|
||||||
$type = $options['oauth_type'];
|
|
||||||
$class = 'Think\\Oauth\\Driver\\'.ucwords($type);
|
$class = 'Think\\Oauth\\Driver\\'.ucwords($type);
|
||||||
if(class_exists($class)) {
|
if(class_exists($class)) {
|
||||||
unset($options['oauth_type']);
|
|
||||||
self::$handler = new $class($options);
|
self::$handler = new $class($options);
|
||||||
return self::$handler;
|
return self::$handler;
|
||||||
}else{
|
}else{
|
||||||
Error::halt('_CACHE_TYPE_INVALID_:'.$type);
|
E('_OAUTH_TYPE_INVALID_:'.$type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user