本文整理汇总了PHP中QC::callback方法的典型用法代码示例。如果您正苦于以下问题:PHP QC::callback方法的具体用法?PHP QC::callback怎么用?PHP QC::callback使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QC
的用法示例。
在下文中一共展示了QC::callback方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wxcallback
public function wxcallback()
{
$this->load->model('user');
$this->load->model('user_openid');
require_once APPPATH . "libraries/WXAPI/wxConnectAPI.php";
$qc = new QC();
$param = $qc->callback();
//$openid = $qc->get_openid();
$useropenid = $this->user_openid->get_by_openid($param['openid']);
if (isset($useropenid->user_id) && $useropenid->user_id > 0) {
$this->user_openid->update(array('token' => $param['access_token'], 'expires' => local_to_gmt() + $param['expires_in'], 'refresh_token' => $param['refresh_token']), $useropenid->id);
$user = $this->user->get($useropenid->user_id);
$login_time = local_to_gmt();
$update_row['last_login_time'] = $login_time;
$update_row['last_login_ip'] = $this->input->ip_address();
//自动保留登录15天
$this->auth->set_auto_login($user->username, $user->password);
if (isset($_COOKIE['lms_logout_url'])) {
$url = $_COOKIE['lms_logout_url'];
setcookie('lms_logout_url', '', time() - 3600, '/');
} else {
$url = base_url();
}
$this->user->update($update_row, $user->id);
//保存session
$this->auth->save_login($user);
redirect($url);
} else {
if (!$useropenid) {
if ($this->user_openid->insert(array('name' => 'weixin', 'token' => $param['access_token'], 'openid' => $param['openid'], 'create_time' => local_to_gmt(), 'expires' => local_to_gmt() + $param['expires_in'], 'refresh_token' => $param['refresh_token']))) {
redirect('register/openid/' . $param['openid']);
} else {
redirect('login/error/login_error');
}
} else {
redirect('register/openid/' . $param['openid']);
}
}
}