# ESCAPE

对指定类型的内容进行转义编码。解码使用UNESCAPE函数。

# 语法

ESCAPE(content, contentType)

  • content:要编码的内容
  • contentType:指定内容的类型,支持四种内容类型htmljshtml-attr

示例地址: ESCAPE (opens new window)

# 示例

  1. ESCAPE('<script>alert("XSS")</script>', 'html'); 转义html,返回字符串&lt;script&gt;alert(&quot;XSS&quot;)&lt;/script&gt;
  2. ESCAPE('Image "Logo"', 'html-attr'); 转义html属性,返回字符串Image &quot;Logo&quot;
是否有帮助?
0条评论
评论