WeiboConnect.class.php 和 QQConnect.class.php 是类库,放在你项目的Lib/ORG目录下面。
common.php 是函数库,放在你项目的Common目录下面,如果你的项目已经有common.php 文件了,就将该内容追加到你的common.php文件最后面。
UserAction.class.php 是一个简单的Demo,仅供参考一下。
config.php 是你项目的配置文件,将其内容添加到你的项目中即可。
配置文件说明:
你可以根据自己需求来配置scope参数。
return array(
// ... ...
'OAUTH' => array(
'QQ_APPKEY' => '100xxxx',
'QQ_APPSECRETKEY' => 'xxxxxxxxxxxxxxxxxxxxxxx',
'QQ_SCOPE' => '',
'QQ_CALLBACK' => 'http://jizhihuwai.com/user/auth/qq',
'WEIBO_APPKEY' => '2xxxxxxxx',
'WEIBO_APPSECRETKEY'=> 'xxxxxxxxxxxxxxxxxxxxxxxxxxx',
'WEIBO_SCOPE' => '',
'WEIBO_CALLBACK' => 'http://jizhihuwai.com/user/auth/weibo',
),
);
返回值:callback() 函数返回openid 和 token,其中微博的openid就是其UID。
get_user_info() 函数返回用户详细信息。
更多详情:
http://wiki.connect.qq.com/get_user_info
http://open.weibo.com/wiki/2/users/show