<?php
/**
* 字符串过滤
* Html::encode 原样输了
* HtmlPuriFile::process 去掉标签全部内容
**/
use \yii\helpers\Html;
use \yii\helpers\HtmlPurifier;
?>
<h1><?=Html::encode('<script>alert(1)</script>')?></h1>
<p><?=HtmlPurifier::process('1111<script>alert(1);</script>')?></p>
05-20
755
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
09-23
79
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
10-06
3255
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交