php搜索代码:
搜索以PHP100开头:
SELECt * FROM teble WHERe title LIKE 'PHP100%'
搜索以PHP100结束:
SELECt * FROM teble WHERe title LIKE '%PHP100'
搜索包含PHP100:
SELECt * FROM teble WHERe title LIKE '%PHP100%'
php搜索代码高亮:
$str = "正品御途T5 行车记录仪 高清夜视 170度广角 重力感应 全场包邮";
$str= preg_replace("/(".$_REQUEST['keywords'].")/i","<font class='ff6'><b>\1</b></font>",$str);
多个关键词搜索:
$k = explode(' ',$_GET['keywords']);
$count = $k;
for($i=0;$i<$cout;$i++){
$where[] = " like '%".$k[$i]."%'";