我希望使用PHP在给定字符串中执行全文搜索给定短语。
我希望这次搜索是:
您能帮我吗?...I很抱歉创建了新的职位,我已经搜索了很多,在我要求之前。然而,我只找到了与PHP+MySQL搜索有关的帖子。
发布于 2015-01-30 14:56:42
您必须使用从字符串中删除diacritics,然后需要使用匹配
<?php
// The "i" after the pattern delimiter indicates a case-insensitive search
if (preg_match("/php/i", "PHP is the web scripting language of choice.")) {
echo "A match was found.";
} else {
echo "A match was not found.";
}
?>PHP文档:http://php.net/manual/en/ref.pcre.php
发布于 2019-12-09 10:39:49
发布于 2015-01-30 15:39:36
对于全文搜索,我知道两个常见的解决方案:
因此,如果您有InnoDB表,则必须将可搜索的信息复制到MYISAM表(例如使用触发器)。
https://stackoverflow.com/questions/28238323
复制相似问题