Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在编写我的第一个论坛并希望有一个搜索字段。
我想知道我应该使用什么函数来搜索数据库中的特定线程。
我应该使用
WHERE title LIKE '%keyword%' OR body LIKE '%keyword%'
这是线程内容的通用搜索算法吗?
需要搜索多个字段,这是非常标准的。
你可能想看看
全文检索功能
和
使用 MySQL 全文搜索
不存在这样的。 您应该选择您需要的和最适合您要求的一种。
但您需要考虑的一些事项是: