Yii2 has 3 ways to select layout
1. Use
public $layout = false; //不使用布局 public $layout = "main"; //设置使用的布局文件
2. Use
$this->layout = false; //不使用布局 $this->layout = "main"; //设置使用的布局文件
$this->context->layout = false; //不使用布局 $this->context->layout = 'main'; //设置使用的布局文件
The above introduces the use of 4 Yii20 layouts, including aspects of content. I hope it will be helpful to friends who are interested in PHP tutorials.