字体:  

查询操作符丢失

lshfong 发表于: 2008-8-28 09:28 来源: PHPChina 开源社区门户

最新回复

yubingyujuan at 2008-8-28 09:36:03
addslashes(htmlspecialchars($content,ENT_QUOTES));
lshfong at 2008-8-28 11:21:42
谢谢你的回答,但我想知道设定和没有设定ENT_QUOTES的区别是什么
心痛 at 2008-8-28 11:33:25
The optional second argument, quote_style, tells the function what to do with single and double quote characters. The default mode, ENT_COMPAT, is the backwards compatible mode which only translates the double-quote character and leaves the single-quote untranslated. 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.
第二个可选参数"引用模式"告诉函数如何处理单引号和双引号。
默认的模式下是"ENT_COMPAT",只处理双引号,,如果设置为"ENT_QUOTES"模式,单双引号全部处理,而"ENT_NOQUOTES"全部不与处理~
lshfong at 2008-8-28 11:50:54
<?php
$aa=htmlspecialchars("<script>alert('信息内容');</script>",ENT_QUOTES);//编码html写入数据库
echo (stripslashes(htmlspecialchars_decode($aa)));//读出数据并解码html并取消斜线 ?>

网页中还是会弹出对话框,怎么处理呢