LOADING STUFF...

PHP字符串函数htmlentities()的用法

技术教程15小时前发布 北陌
12 0 0

PHP字符串函数htmlentities()的用法

htmlentities

(PHP 4, PHP 5)

htmlentities — Convert all applicable characters to HTML entities

说明

string htmlentities
( string $string
[, int $flags = ENT_COMPAT | ENT_HTML401
[, string $encoding = ini_get(“default_charset”)
[, bool $double_encode = true
]]] )

This function is identical to htmlspecialchars() in all
ways, except with htmlentities(), all characters which
have HTML character entity equivalents are translated into these entities.

If you want to decode instead (the reverse) you can use
html_entity_decode().

参数

string

The input string.

flags

A bitmask of one or more of the following flags, which specify how to handle quotes,
invalid code unit sequences and the used document type. The default is
ENT_COMPAT | ENT_HTML401.
Available flags constants
Constant Name
Description
ENT_COMPAT
Will convert double-quotes and leave single-quotes alone.
ENT_QUOTES
Will convert both double and single quotes.
ENT_NOQUOTES
Will leave both double and single quotes unconverted.
ENT_IGNORE
Silently discard invalid code unit sequences instead of returning
an empty string. Using this flag is discouraged as it
»

© 版权声明

相关文章

暂无评论

暂无评论...