- 论坛徽章:
- 0
|
遇到ENT_QUOTES[color="#000000"]使用时候迷茫了,查到
[color="#000000"]If ENT_QUOTES is set, both single and double quotes are translated如果被设置后,单引号双引号都被转义了and if ENT_NOQUOTES is set neither single nor double quotes are translated.
[color="#0000BB"]在使用htmlspecialchars的时候经常会遇到它们'"' (double quote) becomes '"' when ENT_NOQUOTES is not set.''' (single quote) becomes ''' only when ENT_QUOTES is set.举例: $new = htmlspecialchars("Test", ENT_QUOTES);
echo $new; // Test
?>[color="#0000BB"]该例子中单引号被转义为'了。[color="#0000BB"]
[color="#0000BB"]htmlspecialchars($string,ENT_QUOTES)较为常用;[color="#0000BB"]也明显,我们知道了ENT_QUOTES是个预定义常量。[color="#0000BB"]
[color="#000102"]详情咨询: http://php.net/manual/en/function.htmlspecialchars.php[color="#0000BB"]
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u3/108225/showart_2126178.html |
|