P粉2183619722023-09-06 11:48:46
我已經通過以下方式完成了它:
$searchstring = '(victim OR suspect) AND crime NOT covid'; $searchstring = str_replace(" OR ", ' ', $searchstring); $searchstring = str_replace(" AND ", ' +', $searchstring); $searchstring = str_replace(" NOT ", ' -', $searchstring); $searchstring = '+'.$searchstring; $searchresult = RssItem::whereRaw("MATCH (description) AGAINST ('$searchstring' IN BOOLEAN MODE)")->get();
但也許有更好的方法? :-)