Yii框架学习1-1 应用主体的创建、 设置页面设置布局文件

一、应用主题


二、Yii中 views目录下的layouts目录一般存放布局文件,如默认的main.php

想更改单个mothod所加载的布局文件, 可以如下:
1、先在layouts下创建文件 如test.php
2、在mothod中更改layout属性
    public function actionIndex()
    {
        $this->layout = "test";
     return $this->render("index");
    }    

 

如果不想加载布局文件 ,则设置 layout = false; 如:$this->layout = "test";


原文地址:https://www.cnblogs.com/gaogaoxingxing/p/12719932.html