/** * 判断用户是否登录 * * @return boolean|UserForm */ public function isLogin() { /* @var $user UserForm */ $user = WindCookie::get($this->cookieName); if (!$user) { return false; } $stmt = $this->_getConnecion()->createStatement('SELECT * FROM user WHERE username=:username'); if (!$stmt->getValue(array('username' => $user->getUsername()))) { return false; } return $user; }
/** * 取得指定名称的cookie值 * * @param string $name cookie名称 * @param string $pre cookie前缀,默认为null即没有前缀 * @return boolean */ public static function getCookie($name) { $pre = Wekit::C('site', 'cookie.pre'); $pre && $name = $pre . '_' . $name; return WindCookie::get($name); }
/** * 获取cookie值 * * @param string $name * @return void */ public function get($name) { $this->prefix && ($name = $this->prefix . $name); return WindCookie::get($name, $this->encode); }
public function getToken($tokenName) { return WindCookie::get($tokenName); }