Home > PHP Framework > YII > How to set yii2 not to use layout

How to set yii2 not to use layout

王林
Release: 2019-12-17 17:01:15
Original
3079 people have browsed it

How to set yii2 not to use layout

The method to set up not using layout in yii2:

Member variables within the controller

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

Inside the controller member method

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

Select layout in view

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

Recommended related articles and tutorials: yii tutorial

The above is the detailed content of How to set yii2 not to use layout. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template