php - What is the default controller in Yii2 framework? -


how find default controller in yii2 when defaultroute isn't set application frontend working fine ?

figured out finally. try echoing yii::$app->defaultroute somewhere in view file or controller action.

echo yii::$app->defaultroute; 

according official documentation on yii2 controller on default controller:

each application has default controller specified via yii\base\application::defaultroute property. when request not specify route, route specified property used. yii\web\application|web applications, value 'site', while yii\console\application|console applications, 'help'.

therefore, if url http://hostname/index.php, 'site' controller handle request.

also, may change default controller following application configuration:

[     'defaultroute' => 'main', ] 

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -