Home > Backend Development > PHP Tutorial > 4 Use of Yii20 layout

4 Use of Yii20 layout

WBOY
Release: 2016-08-08 09:24:00
Original
964 people have browsed it

Yii2 has 3 ways to select layout


1. Use

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


2. Use

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

in the controller member method 3. Select layout in the view
$this->context->layout = false; //不使用布局
$this->context->layout = 'main'; //设置使用的布局文件
Copy after login

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.

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