<?php
namespace app\controllers;
use yii\web\Controller; class HelloController extends Controller
{
public function actionIndex()
{
$hellp_str = "hello God!"; $data = array(); $data["view_hello_str"] = $hello_str; return $this->renderPartial("index",$data);
}
}
?> views\hello\index.php $helper_str = "hello world!<script>console.log(111);</script>" <?php
use yii\helpers\Html;//转义
use yii\helpers\HtmlPurifier;//过滤html <h1><?= Html::encode($view_hello_str);?></h1> <!--Html::encode() 能防止跨站脚本攻击,转义html标签-->
<h1><?= HtmlPurifier::process($view_hello_str);?></h1>

<?= $this->render('_overview') ?><!--在一个视图中调用另一个视图-->

禁用布局

控制器内控制 public $layout=false/'layout'
控制器成员方法内控制 $this->layout=false/'layout'
视图中选择布局 $this->context->layout=false/'layout'

最新文章

  1. REq,RES编码设置
  2. [Unity] 精灵动画制作中需要注意的一些问题
  3. canvas draw a image
  4. C166 Interfacing C to Assembler
  5. ios Swift 资源池
  6. Implement the hash table using array / binary search tree
  7. webstrom 编码
  8. 解决关于win10下eclipse代码格式化不生效问题
  9. MySQL Sending data导致查询很慢的问题详细分析【转载】
  10. java中的Condition协作线程接口类
  11. 本科理工男如何学习Linux
  12. 文件-- 字节相互转换(word、图片、pdf...)
  13. django----数据库操作(对model增删改查)
  14. Java判断一个字符串中有多少大写字母、小写字母和数字
  15. Docker制作私有的基础镜像
  16. struts2的MVC模式
  17. 设计模式 结构型模式 外观模式(Facade Pattern)
  18. 20165233 Java第四章学习总结
  19. Linux命令详解-touch
  20. GPU编程自学4 —— CUDA核函数运行参数

热门文章

  1. 【Java8新特性】Lambda表达式
  2. SpringCloud基础概念学习笔记(Eureka、Ribbon、Feign、Zuul)
  3. 【单片机】CH32V103C8T6 ——窗口看门狗
  4. 《回炉重造 Java 基础》——集合(容器)
  5. SAM[详细~bushi]
  6. 关于『HTML』:第二弹
  7. Spring Security OAuth正式终止维护,已从官网下架
  8. python 的 @staticmethod和@classmethod和普通实例方法
  9. HashMap高阶用法,十倍提升开发效率
  10. python 连接SAP 代码