要插在sql里面的都要处理过

解决方案 »

  1.   

    htmlspecialchars("$ntxt");
    用这个函数处理,但是从数据库读取的同时,输出,也应该处理
    处理类似:
    $text = eregi_replace('&',('&'),$text);
    $text = eregi_replace('&lt;',('<'),$text);
    $text = eregi_replace('&gt;',('>'),$text);
    $text = eregi_replace('&quot;',('"'),$text); $text = htmlspecialchars($text);
    $text = str_replace("\n ", "<br>&nbsp;", $text);
    $text = str_replace("\n", "<br>", $text);
    $text = str_replace("  ", "", $text);具体的你可以看下:http://art.21e.cn/tec/7/witchina1644.htm