@Html.Raw()

asp.net mvc中把html字符串以html效果输出来,

@string变更输出的是HTML代码,

如果想以HTML标签效果输出来可以用函数@Html.Raw(str) 输出来的就是网效果了,

比如有个字符串是这样的<font color='red'>红字</font>

如果是用@Html.Raw('<font color='red'>红字</font>'),就会显示出红色的”红字“,

不用的话会直接显示这段html字符串(<font color='red'>红色文字</font>)

多一分冷靜,少一分浮躁
原文地址:https://www.cnblogs.com/AnnyGird-LiMing/p/4873976.html