本文整理匯總了PHP中QC::__call方法的典型用法代碼示例。如果您正苦於以下問題:PHP QC::__call方法的具體用法?PHP QC::__call怎麽用?PHP QC::__call使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類QC
的用法示例。
在下文中一共展示了QC::__call方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: qq_sucsess
public function qq_sucsess()
{
session_start();
define('M_ROOT', dirname(dirname(__FILE__)));
$ss = M_ROOT;
$str = str_replace("\\", "/", $ss);
include_once $str . "/API/qq/qqConnectAPI.php";
$qc = new \QC();
$atid = $qc->qq_callback();
$opid = $qc->get_openid();
$opid = (string) $opid;
$state = I('state');
$_SESSION['state'] = $state;
$qc = new \QC($atid, $opid);
// 重新帶參地new一次否則會丟失信息
$user_model = D('yuser');
$find = $user_model->field('uid,username,nickname,figureurl,userpic')->where(' openid=' . '"' . $opid . '"')->find();
if (empty($find)) {
$info = $qc->__call('get_user_info');
}
if (!empty($info)) {
$data = array('username' => $info['nickname'], 'nickname' => $info['nickname'], 'sex' => $info['gender'], 'province' => $info['province'], 'city' => $info['city'], 'year' => $info['year'], 'figureurl' => $info['figureurl_qq_2'], 'openid' => $opid, 'tokenid' => $atid, 'addtime' => date('Y-m-d H:i:s'), 'loginip' => get_client_ip(), 'status' => 1);
if ($id = $user_model->add($data)) {
$user = $user_model->field('uid,username,figureurl,userpic')->where('uid=' . $id)->find();
$picName = $find['userpic'];
$picInfo = pathinfo($picName);
$find['userpic'] = $picInfo['filename'] . '70.' . $picInfo['extension'];
$_SESSION['user'] = $user;
$this->redirect('/Index', '登錄成功,正在跳轉到首頁', 0);
}
} else {
$picName = $find['userpic'];
$picInfo = pathinfo($picName);
$find['userpic'] = $picInfo['filename'] . '70.' . $picInfo['extension'];
$qiandao = $user_model->getQiandao($find['uid']);
$find['qiandao'] = $qiandao;
$data = array('lastlogin' => date('Y-m-d H:i:s', time()), 'uid' => session('user.uid'));
$user_model->save($data);
$_SESSION['user'] = $find;
$this->redirect('/Index', '登錄成功,正在跳轉到首頁', 0);
}
}