选择语言 :

 Core_HTML::chars

Convert special characters to HTML entities. All untrusted content should be passed through this method to prevent XSS injections.

echo HTML::chars($username);
string Core_HTML::chars( string $value [, boolean $double_encode = bool true ] )

参数列表

参数 类型 描述 默认值
$value string String to convert
$double_encode boolean Encode existing entities bool true
返回值
  • string
File: ./core/classes/html.class.php
public static function chars($value, $double_encode = true)
{
    return @htmlspecialchars((string)$value, ENT_QUOTES, Core::$charset, $double_encode);
}