How to create route in yii?
Yii – URL Routing
- Step 1 − Modify the config/web. …
- Step 2 − Got to http://localhost:8080/index.php. …
- Step 3 − Add the following function to the SiteController.
- Step 4 − Then, modify the config/web. …
- Step 5 − Now enter any URL of your application, you will see the following.
How routing works in yii?
When a Yii application starts processing a requested URL, the first step it takes is to parse the URL into a route. The route is then used to instantiate the corresponding controller action to handle the request. This whole process is called routing.
How can I get base URL in Yii?
Anytime you see get as the function base name, it is a getter function. Meaning you can just do: Yii::$app->urlManager->baseUrl .