MyFirstController –> /my-frist-controllerCamel Case wird in Bindestrich und Kleinbuchstaben umgewandelt
Funktion action<WHAT> bildet die Seite WHAT
$this→render(view:'name')public function behaviors() { return [ 'access' => [ 'class' => AccessControl::class, 'only' => ['logout'], 'rules' => [ [ 'actions' => ['logout'], 'allow' => true, 'roles' => ['@'], ], ], ], // verbs beziehen sich auf Aktionen 'verbs' => [ // Filter blockieren Requests basierend auf bestimmten Parameter oder verändern die Response. 'class' => VerbFilter::class, 'actions' => [ 'logout' => ['post'], ], ], ]; }
public function actionWhatever() { $this->layout = 'whatever'; // benutzt view/layouts/whatever.php als layout anstelle von main.php }
echo $content; einfügen.<?php ... AppAsset::register($this); $this->beginContent(viewFile: '@path/to/base.php'); ?> <div> <?php echo $this->render(view: 'main'); </div> <?php $this->endContent();