/** * 获取用户的登录状态 **/ public function actionGetUserType() { $ret = array('status' => 0, 'msg' => ''); try { $ps = new permission(); $ps_ret = $ps->usermodeSeleteStatus($_SESSION['userid']); if (!isset($ps_ret[0]['sessionid']) || $ps_ret[0]['sessionid'] != session_id()) { throw new Exception('账户已在其他地方登录'); } $ret['status'] = 1; } catch (Exception $e) { $ret['msg'] = $e->getMessage(); } echo json_encode($ret); }