{ if ($this->getIsActive()) { return; } $this->registerSessionHandler(); $this->setCookieParamsInternal(); YII_DEBUG ? session_start() : @session_start(); if ($this->getIsActive()) { Yii::info('Session started', __METHOD__); $this->updateFlashCounters(); } else { $error = error_get_last(); $message = isset($error['message']) ? $error['message'] : 'Failed to start session.'; Yii::error($message, __METHOD__); }
} $this->registerSessionHandler(); $this->setCookieParamsInternal(); YII_DEBUG ? session_start() : @session_start(); if ($this->getIsActive()) { Yii::info('Session started', __METHOD__); $this->updateFlashCounters(); } else { $error = error_get_last();
/** * @param mixed $key session variable name * @return bool whether there is the named session variable */ public function has($key) { $this->open(); return isset($_SESSION[$key]); } /** * Updates the counters for flash messages and removes outdated flash messages. * This method should only be called once in [[init()]].
/** * {@inheritdoc} */ public function beforeAction($action) { if (Yii::$app->session->has('lang')) { Yii::$app->language = Yii::$app->session->get('lang'); } else { //or you may want to set lang session, this is just a sample Yii::$app->language = 'fa-IR'; } if (parent::beforeAction($action)) {
break; } } $result = null; if ($runAction && $this->beforeAction($action)) { // run the action $result = $action->runWithParams($params); $result = $this->afterAction($action, $result); // call afterAction on modules
$parts = $this->createController($route); if (is_array($parts)) { /* @var $controller Controller */ list($controller, $actionID) = $parts; $oldController = Yii::$app->controller; Yii::$app->controller = $controller; $result = $controller->runAction($actionID, $params); if ($oldController !== null) { Yii::$app->controller = $oldController; } return $result; }
$params = $this->catchAll; unset($params[0]); } try { Yii::debug("Route requested: '$route'", __METHOD__); $this->requestedRoute = $route; $result = $this->runAction($route, $params); if ($result instanceof Response) { return $result; } $response = $this->getResponse(); if ($result !== null) {
{ try { $this->state = self::STATE_BEFORE_REQUEST; $this->trigger(self::EVENT_BEFORE_REQUEST); $this->state = self::STATE_HANDLING_REQUEST; $response = $this->handleRequest($this->getRequest()); $this->state = self::STATE_AFTER_REQUEST; $this->trigger(self::EVENT_AFTER_REQUEST); $this->state = self::STATE_SENDING_RESPONSE; $response->send();
$application = new yii\web\Application( $config ); $application->run(); ?>
$_GET = [ 'id' => '8363', ];