码迷,mamicode.com
首页 > 系统相关 > 详细

YII 2.x 模板文件的 beginBlock、beginContent、beginCache

时间:2017-01-06 22:36:02      阅读:298      评论:0      收藏:0      [点我收藏+]

标签:main   --   nbsp   pre   内容   ram   view   div   this   

 

echo ‘-----------beginBlock--------------------- <br />‘;
$this->beginBlock(‘block1‘,  false);
    echo ‘beginBlock demo 1 <br />‘;
$this->endBlock();
echo $this->blocks[‘block1‘];


$this->beginBlock(‘block2‘,  true);
    echo ‘beginBlock demo 2 <br />‘;
$this->endBlock();

echo ‘-----------beginContent--------------------- <br />‘;
// 渲染内容,传递给文件
$this->beginContent(‘@app/views/layouts/main.php‘,  array(‘param1‘=>‘param1_value‘));
    echo ‘beginContent demo1...‘;
$this->endContent();


echo ‘-----------beginCache--------------------- <br />‘;
if($this->beginCache(‘beginCache1‘)){
    echo $this->renderDynamic("echo ‘beginCache demo1... <br />‘;");
    $this->endCache();
}

 

YII 2.x 模板文件的 beginBlock、beginContent、beginCache

标签:main   --   nbsp   pre   内容   ram   view   div   this   

原文地址:http://www.cnblogs.com/xiaoyaogege/p/6257307.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!