} /** * @inheritdoc * @internal Based on \yii\web\Request::resolve(), but we don't modify $_GET/$this->_queryParams in the process. */ public function resolve(): array { if (($result = Craft::$app->getUrlManager()->parseRequest($this)) === false) { throw new NotFoundHttpException(Craft::t('yii', 'Page not found.')); } [$route, $params] = $result; /** @noinspection AdditionOperationOnArraysInspection */ return [$route, $params + $this->getQueryParams()]; } /**
* @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], '/');
if (($response = $this->_processActionRequest($request)) !== null) { return $response; } // If we’re still here, finally let Yii do its thing. try { return parent::handleRequest($request); } catch (Throwable $e) { $this->_unregisterDebugModule(); throw $e; } }
{ 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();
// Load shared bootstrap require dirname(__DIR__) . '/bootstrap.php'; // Load and run Craft /** @var craft\web\Application $app */ $app = require CRAFT_VENDOR_PATH . '/craftcms/cms/bootstrap/web.php'; $app->run();
$_GET = [ 'p' => 'films/donald-daffy', ];