unescape
unescape
用于解码 entity
、html
和 htmlall
。它会针对给定类型抵消 escape 修饰符 的作用。
基本用法
参数
参数位置 | 类型 | 必需 | 可能值 | 默认值 | 描述 |
---|---|---|---|---|---|
1 | 字符串 | 否 | html 、htmlall 、entity 、 |
html |
这是要使用的 escape 格式。 |
2 | 字符串 | 否 | ISO-8859-1 、UTF-8 ,以及 htmlentities() 支持的任何字符集 |
UTF-8 |
传递至 html_entity_decode() 或 htmlspecialchars_decode() 或 mb_convert_encoding() 等的字符集编码。 |
范例
<?php
$smarty->assign('articleTitle',
"Germans use "Ümlauts" and pay in €uro"
);
下面是示例 unescape
模板行,其后是输出
{$articleTitle}
Germans use "Ümlauts" and pay in €uro
{$articleTitle|unescape:"html"}
Germans use "Ümlauts" and pay in €uro
{$articleTitle|unescape:"htmlall"}
Germans use "Ümlauts" and pay in €uro
另请参阅 转义 smarty 解析、escape 修饰符。