function __construct($swoole) { parent::__construct($swoole); if (isset($_POST["PHPSESSID"])) { $_COOKIE['PHPSESSID'] = $_POST["PHPSESSID"]; session_id($_COOKIE['PHPSESSID']); } Swoole::$php->session->start(); Swoole\Auth::$login_url = '/page/login/?'; if (Swoole\Auth::login_require() === false) { return $this->swoole->http->finish(); } $this->uid = $_SESSION['user_id']; }
function chatroom() { session(); Swoole\Auth::$login_url = '/page/login/?'; Swoole\Auth::login_require(); $userInfo = createModel('UserInfo'); $this->swoole->tpl->assign('user', $userInfo->get($_SESSION['user_id'])->get()); $this->swoole->tpl->display(); }