一段很简单的代码,刚刚写的时候有用,平时是用来替换空格为-的 <?PHP $rep_product_id=$myrow["product_id"];           if (substr_count($rep_product_id,"$keywords")>0){                 $rep_product_id= str_replace("$keywords","<font color=red>".$keywords."</font>",$rep_product_id);                 }                 echo $rep_product_id?> PHP查询显示关键字为红色