wyyuan 发表于 2007-2-7 18:33

[求助]数据库

为什么我的数据库不能存储标点符号之类的东西?<BR>请教如何处理呀!!!

JavaEE5 发表于 2007-2-8 08:55

function html_encode($html) {<br>    $html = str_replace("&amp;", "&amp;amp;", $html);<br>    $html = str_replace("&lt;", "&amp;lt;", $html);<br>    $html = str_replace("&gt;", "&amp;gt;", $html);<br>    $html = str_replace('\"', "&amp;quot;", $html);<br>    $html = str_replace("\'", "''", $html);<br>    $html = str_replace("  ", " &amp;nbsp;", $html);<br>    $html = str_replace("\n", "&lt;br /&gt;", $html);<br>    return $html;<br>}

wyyuan 发表于 2007-2-8 16:37

这个函数怎么用呀?? <br>

JavaEE5 发表于 2007-2-9 13:05

这都不明白吗?<br>假如$content将要插入数据库。。。<br><br>$content = html_encode($content)

wyyuan 发表于 2007-2-9 13:55

谢谢, 我是个超级新手<br>谢谢帮助

页: [1]

编程论坛