esc_textarea()

将元素中的文本编码成 HTML 实体

描述

已经是 HTML实体中的 & 还会再次被编码!

用法

<?php esc_textarea( $text ); ?>

参数

$text

(string) (必填) 将编码成实体的文本。

默认值: None

返回值

(string) 

已经编码成 HTML 实体的文本。

历史

添加于 版本: 3.1

源文件

esc_textarea() 函数的代码位于 wp-includes/formatting.php.

/**
* Escaping for textarea values.
*
* @since 3.1.0
*
* @param string $text
* @return string
*/

function esc_textarea( $text ) {

$safe_text = htmlspecialchars( $text, ENT_QUOTES, get_option( ‘blog_charset’ ) );

/**

* Filter a string cleaned and escaped for output in a textarea element.
*
* @since 3.1.0
*
* @param string $safe_text The text after it has been escaped.
* @param string $text      The text prior to being escaped.
*/

return apply_filters( ‘esc_textarea’, $safe_text, $text );

}
0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索