Home  >  Article  >  Backend Development  >  Yii2 uses five module layout files

Yii2 uses five module layout files

WBOY
WBOYOriginal
2016-08-08 09:30:39984browse

Normally, the layout file used by a view is:

/basic/views/layouts/main.php

And we often need to define the view used by a module by ourselves. In this case, we only need to define it in the corresponding controller. Add in php:

public $layout="rbac/rbacadmins.php";

 (the default action can also be changed, use public $defaultAction='index';)


At the same time, copy the default layouts/main.php to generate a new layout.php file and place it in the corresponding location:

/basic/views/layouts/rbac/rbacadmins.php

.

The above introduces the use of five module layout files in Yii2, including aspects of the content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
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