-
Book Overview & Buying
-
Table Of Contents
Yii2 By Example
By :
A console controller is totally similar to the web controllers that we created earlier. It extends the \yii\console\Controller base class and can return an integer value indicating the status response of the action (0 stands for successful execution of the action), also named exit code.
The public properties of the controller can be made available as an option only if their names are returned by the options() method that accepts actionID as the parameter; so the response can be customized according to actionID.
The response of the options() method is an array of text string that represents the public property names of the controller.
Starting from the advanced template application that we previously installed in the yiiadv folder, let's create a new console controller named MyExampleController in console/controllers/MyExampleController.php with the following content:
<?php namespace console\controllers; use \yii\console\Controller; /** * This is an...
Change the font size
Change margin width
Change background colour