/** * 初始化 */ protected function initialize() { parent::initialize(); //Prepend the application name to the title \Phalcon\Tag::prependTitle('Blog | '); $this->view->setTemplateAfter('common'); }
/** * @param unknown $dispatcher */ public function beforeExecuteRoute($dispatcher) { $public_controller = array('index'); parent::beforeExecuteRoute($dispatcher); if ($this->checkIsLogin()) { $this->user = $this->session->get('user'); } else { if (!in_array($this->controller, $public_controller)) { $this->response->redirect('/login', true); } } }
/** * 初始化 */ protected function initialize() { parent::initialize(); //Prepend the application name to the title \Phalcon\Tag::prependTitle('Blog | '); if ($this->checkIsLogin()) { $this->admin = $this->session->get('admin'); } else { $this->response->redirect('/login', true); } $this->view->setTemplateAfter('common'); }