常用函数-attribute_escape()

0条评论

常用函数-attribute_escape()

说明

在HTML属性中,该函数对特定HTML字符(包括单引号和双引号)进行字符转义或将这些字符译为计算机语言。该函数工作方式类似于标准的PHP函数 htmlspecialchars,唯一不同在于该函数不会对HTML实体进行双重编码(例如,该函数用 &&代替&&)。

attribute_escape位于/wp-includes/formatting.php中。

用法

<?php echo attribute_escape($text); ?>

参数

$text

(字符串)即将被转义的文本

发表新评论

此内容将保密,不会被其他人看见。
  • 自动将网址与电子邮件地址转变为链接。
  • 允许HTML标签:<a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • 自动断行和分段。

更多关於格式化选项的信息

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.