From [[https://www.tutorialspoint.com/yii/yii_using_controllers.htm]]\\


First we create our own controller called //ExampleController.php// in the controllers folder\\
<code php>
<?php

namespace app\controllers;

use yii\web\Controller;

class ExampleController extends Controller
 {
 }
</code>
An example action to put in the Controller can be one that calls the //index.php// view file\\
<code php>
 public function actionIndex()
 {
  $message = 'Index action of the ExampleController';
  return $this->render('index',['message'=>$message]);
 }
</code>

Create a view file for example called //example.php//
<code php>
<?php
use yii\helpers\Html;
?>
<?= Html::encode($message); ?>
</code>
PS we could also use 
<code php>
<?php echo $message; ?>
</code>
for this example.\\
Also to change the default controller, put in //config\web.php// under the $config section
<code php>
'defaultRoute' => 'example',
</code>
and the default action in the controller by putting into the controller code
<code php>
public $defaultAction = 'hello-world';
</code>