有一个数据库搜索,比如name是王小,如何在<input>表单中输入“王 小”“ 王小”“王小 (3个都有空格)”都可以搜出王小???我用的是mysql的like模糊查找和php。谢谢各位了!

解决方案 »

  1.   

    怎么replace啊?我是新手!!!!!!!!
      

  2.   

    $string=" 王 小 ";
    $nospace=preg_replace("/ /","",$string);
      

  3.   

    我自己的,很管用。
    function del3210($html){
    $html = str_replace(chr(32), '', $html);
    $html = str_replace(chr(10), '', $html);
    $html = str_replace(chr(13), '', $html);
    $html = str_replace("<p></p>",null, $html);
    $html = str_replace("<p>&nbsp;</p>",null, $html);
    $html = htmlspecialchars(trim($html));
    $html = str_replace("&lt;/p&gt;",null, $html);
    return $html;
    }
      

  4.   

    当您的问题得到解答后请及时结贴.
    http://topic.csdn.net/u/20090501/15/7548d251-aec2-4975-a9bf-ca09a5551ba5.html