闲者博客 - 关键词 2022-02-26T17:36:47+08:00 Typecho https://bk1314.com/feed/atom/tag/%E5%85%B3%E9%94%AE%E8%AF%8D/ <![CDATA[PHP循环遇到关键词就跳过分享]]> https://bk1314.com/46.html 2022-02-26T17:36:47+08:00 2022-02-26T17:36:47+08:00 飞鱼 http://www.typecho.org $keyword_arr=['词1','词2','词3']; //也可以上面数据库存入 function checKeyword($str='',$keyword_arr=[]){ foreach ($keyword_arr as $keyword) { //var_dump($keyword); if (strstr($str, $keyword) != FALSE)return true; } return false; } while($r = mysql_fetch_array($query)){ $bt=$r['ybt'];//标题 $strtolowerbt=strtolower($bt); if(checKeyword($strtolowerbt,$keyword_arr)) { continue; } } ]]>