效果不是很好的一种方法:skey="<font color=red>"&key&"</font>"
结果=replace(结果,key,skey)其他的牵涉到大字符集的东东,一般都是写函数或别的组件处理

解决方案 »

  1.   

    $content=str_replace("$key","<font color=red>$key</font>",$row->content);
      

  2.   

    $str = mb_ereg_replace("($keyword)", "<font color=red>\\1</font>", $str);
    用这个比较安全些,不会出现乱码。
    楼上给的是ASP的吧,哈哈,这里是PHP
      

  3.   

    "<font color=red>\\1</font>"是什么意思?
      

  4.   

    $str = mb_ereg_replace("($keyword)", "<font color=red>\\1</font>", $str);
    是什么意思>?
      

  5.   

    可能你没有打开php_mbstring.dll扩展库,在PHP。INI里设置一下。
    你可以看看手册,我那个是什么意思。
    http://www.php.net/manual/zh/function.preg-replace.php
      

  6.   

    to  kingerq(多菜鸟)
    如果服务器不是自己的,这个功能就难实现了
      

  7.   

    使用str_replace的时候,$key包含特殊字符的时候,难道使用addslashes函数也不行吗?str_replace(addslashes($key),"<font color=red>{$key}</font>",$data);