{ 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();
* If the specified name already exists, the old value will be overwritten. * @param string $key session variable name * @param mixed $value session variable value */ public function set($key, $value) { $this->open(); $_SESSION[$key] = $value; } /** * Removes a session variable. * @param string $key the name of the session variable to be removed
public function actionViewcar($id) { $params = []; $params['car'] = Cars::find()->where(['id' => $id])->one(); if ($params['car']) { Yii::$app->session->set('carId', $id); $params['error'] = Yii::$app->session->get('error'); $params['locations'] = Locations::find()->where(['publish' => 1,'language_id'=>Yii::$app->params['language']['lang_id']])->all(); $params['addiational'] = Additional::find()->where(['publish' => 1,'language_id'=>Yii::$app->params['language']['lang_id']])->all(); return $this->render('view_car', $params); } $this->redirect(['site/index']);
$args = $this->controller->bindActionParams($this, $params); Yii::debug('Running action: ' . get_class($this->controller) . '::' . $this->actionMethod . '()', __METHOD__); if (Yii::$app->requestedParams === null) { Yii::$app->requestedParams = $args; } return call_user_func_array([$this->controller, $this->actionMethod], $args); } }
} $result = null; if ($runAction && $this->beforeAction($action)) { // run the action $result = $action->runWithParams($params); $result = $this->afterAction($action, $result); // call afterAction on modules foreach ($modules as $module) { /* @var $module Module */
$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();
require __DIR__ . '/../vendor/autoload.php'; require __DIR__ . '/../vendor/yiisoft/yii2/Yii.php'; $config = require __DIR__ . '/../config/web.php'; require __DIR__ . '/../components/Starter.php'; (new \app\components\bootstrap\Starter($config))->run();
$_GET = [ 'r' => 'booking/viewcar', 'id' => '60', 'lang' => 'fa', ];