{ 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 string $key the session variable name * @param mixed $defaultValue the default value to be returned when the session variable does not exist. * @return mixed the session variable value, or $defaultValue if the session variable does not exist. */ public function get($key, $defaultValue = null) { $this->open(); return isset($_SESSION[$key]) ? $_SESSION[$key] : $defaultValue; } /** * Adds a session variable. * If the specified name already exists, the old value will be overwritten.
* @return string|null the persisted language code or null if none found */ protected function loadPersistedLanguage() { $language = null; if ($this->languageSessionKey !== false) { $language = Yii::$app->session->get($this->languageSessionKey); $language!==null && Yii::trace("Found persisted language '$language' in session.", __METHOD__); } if ($language === null) { $language = $this->_request->getCookies()->getValue($this->languageCookieName); $language!==null && Yii::trace("Found persisted language '$language' in cookie.", __METHOD__); }
if ($reset || $normalized) { $this->redirectToLanguage(''); } } else { $language = null; if ($this->enableLanguagePersistence) { $language = $this->loadPersistedLanguage(); } if ($language === null) { $language = $this->detectLanguage(); } if ($language === null || $language === $this->_defaultLanguage) { if (!$this->enableDefaultLanguageUrlCode) {
parent::parseRequest($request); } catch (UrlNormalizerRedirectException $e) { $normalized = true; } } $this->_processed = true; $this->processLocaleUrl($normalized); } } return parent::parseRequest($request); } /**
* Resolves the current request into a route and the associated parameters. * @return array the first element is the route, and the second is the associated parameters. * @throws NotFoundHttpException if the request cannot be resolved. */ public function resolve() { $result = Yii::$app->getUrlManager()->parseRequest($this); if ($result !== false) { list($route, $params) = $result; if ($this->_queryParams === null) { $_GET = $params + $_GET; // preserve numeric keys } else { $this->_queryParams = $params + $this->_queryParams;
* @throws NotFoundHttpException if the requested route is invalid */ public function handleRequest($request) { if (empty($this->catchAll)) { try { list($route, $params) = $request->resolve(); } catch (UrlNormalizerRedirectException $e) { $url = $e->url; if (is_array($url)) { if (isset($url[0])) { // ensure the route is absolute $url[0] = '/' . ltrim($url[0], '/');
{ 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();
require __DIR__ . '/../../common/config/main.php', require __DIR__ . '/../../common/config/main-local.php', require __DIR__ . '/../config/main.php', require __DIR__ . '/../config/main-local.php' ); (new yii\web\Application($config))->run(); ?>
$_GET = [ 'category_id' => '134', 'city_id' => '11', 'p' => [ 868 => '870', 116 => '348', ], ];