Gii-コントローラーの生成
コントローラを生成する方法を見てみましょう。
Step 1 −いくつかのアクションでコントローラーを生成するには、フォームに入力するコントローラージェネレーターインターフェイスを開きます。

Step 2−次に、「プレビュー」ボタンと「生成」をクリックします。ザ・CustomController.php index、hello、およびworldアクションを含むファイルがcontrollersフォルダーに生成されます。
<?php
namespace app\controllers;
class CustomController extends \yii\web\Controller {
public function actionHello() {
return $this->render('hello');
}
public function actionIndex() {
return $this->render('index');
}
public function actionWorld() {
return $this->render('world');
}
}
?>
フォームの生成
Step 1 −既存のモデルからビューファイルを生成するには、フォーム生成インターフェイスを開いてフォームに入力します。

次に、「プレビュー」ボタンと「生成」をクリックします。カスタムビュービューファイルは、ビューフォルダに生成されます。
Step 2 −表示するには、に新しいメソッドを追加します CustomController。
public function actionView() {
$model = new MyUser();
return $this->render('/customview', [
'model' => $model,
]);
}
Step 3 −生成されたビューファイルを表示するには、URLを開きます http://localhost:8080/index.php?r=custom/view。
