yii2中 选择布局的方式,可以设置不使用布局

###yii2中 选择布局的方式,可以设置不使用布局

控制器内成员变量

public $layout = false; //不使用布局
public $layout = "main"; //设置使用的布局文件

控制器成员方法内

$this->layout = false; //不使用布局
$this->layout = "main"; //设置使用的布局文件

视图中选择布局

$this->context->layout = false; //不使用布局
$this->context->layout = 'main'; //设置使用的布局文件

猜你喜欢

转载自www.cnblogs.com/alisleepy/p/11200345.html
今日推荐