How do I replace bad words with php?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have some text i need to filter out a list of bad words in like: $bad_words = array( 'word1' => 'gosh', 'word2' => 'darn', ); I can loop through these and replace one at a time but that is slow right? Is there a better way? 回答1: Yes there is. Use preg_replace_callback() :