php - Design issues with sensitive word filtering function? ?
高洛峰
高洛峰 2017-06-07 09:23:03
0
1
648

is to filter the content submitted by the user for sensitive words. If the sensitive words are stored in the database, write a sensitive word filtering function (query the sensitive words from the database).
If the user submits content, it will be called This function means that the database must be queried every time, so the design feels unreasonable.

I would like to ask how to design the sensitive word filtering more rationally. Is it okay to write the sensitive words into the configuration file of the project and not store them in the database?

高洛峰
高洛峰

拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...

reply all(1)
仅有的幸福

Yes, you can separate the inscriptions by separators and save them into a text file, or directly use a script to generate json and save it into the file. When reading, parse and read directly.
There is also a faster way. If there are not too many inscriptions (only a few hundred to 2 or 3 thousand), you can directly save them in a configuration file in the form of an array and return an array. The array is retrieved directly each time.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template