Render方法
在view中添加资源
$this->render('about.php',['test'=>5]); $content = $this->renderPartial('about',['test'=>5]); $this->renderContent($content); $this->renderFile('full file name',['test'=>5]); $this->renderAjax('about',['test'=>'test']);
查找view文件的5种方式
-
别名开头,路径指定view文件
@app/views/site/about.php -
//开头,使用 app目录下面的views
//site/about.php -
/开头,使用当前Module中的views
/site/about.php -
直接使用字符串,ViewContextInterface接口返回的view
about,login -
上次所使用
在view中添加资源
- meta标签、
- link标签
- 添加css、js代码
- 引入css、js文件,以及先后顺序
在线播放
下载地址
关注编程技巧 回复19领350本编程书籍