PHP学会网 php培训网 PHP暑期培训 PHP寒假培训 PHP假期培训 » 入门和基础知识 » 容易混淆的结果函数(1)
本页主题: 容易混淆的结果函数(1) 打印 | 加为IE收藏 | 收藏主题 | 上一主题 | 下一主题

admin



该用户目前不在线
级别: 新手上路
精华: 0
发帖: 0
威望: -1 点
金钱: -10 PYMB
贡献值: 0 点
在线时间:0(小时)
注册时间:2005-09-27
最后登录:2007-08-26

容易混淆的结果函数(1)


顶端 Posted: 2005-09-22 13:50 | [楼 主]
admin



该用户目前不在线
级别: 新手上路
精华: 0
发帖: 0
威望: -1 点
金钱: -10 PYMB
贡献值: 0 点
在线时间:0(小时)
注册时间:2005-09-27
最后登录:2007-08-26

容易混淆的结果函数(1)


[b]htmlspecialchars[/b]
(PHP 3, PHP 4 )

把html语言的特殊标记变成转义的符号
htmlspecialchars -- Convert special characters to HTML entities
Description
string htmlspecialchars ( string string [, int quote_style [, string charset]])


'&' (ampersand) becomes '&'

'"' (double quote) becomes '"' when ENT_NOQUOTES is not set.

''' (single quote) becomes ''' only when ENT_QUOTES is set.

'<' (less than) becomes '<'

'>' (greater than) becomes '>'

例子 1. htmlspecialchars() example

[code]
$new = htmlspecialchars("Test", ENT_QUOTES);
echo $new; // <a href='test'>Test</a>
?>

[b]htmlentities[/b]
(PHP 3, PHP 4 )

htmlentities -- Convert all applicable characters to HTML entities
与前一个函数相同,但是他是把所有的字符转换了

[b]nl2br[/b]
(PHP 3, PHP 4 )

nl2br -- Inserts HTML line breaks before all newlines in a string
字符串中有换行标记的转换成html 的

[/code]
顶端 Posted: 2005-09-22 13:50 | 1 楼
PHP学会网 php培训网 PHP暑期培训 PHP寒假培训 PHP假期培训 » 入门和基础知识

时:01-08 20:10 Copyright © 2006 phpwhy.com 权
ICP05060669

曳息 -