A有一句话:如何从MySQL数据库中查找并替换文本中的单词?
“如何从mysql数据库中查找并替换文本中的单词?”
和MySQL表单词,有3列id,word和replaceWord。 我在数据库中有超过4000个单词。
表:
id word replaceWord
1 text sentence
2 word letter
3 mysql MySQL
4 .. ...
5 .. ...
6 .. ...
结果: “如何找到并从更换信在句子的MySQL数据库”
我知道如何做到这一点没有数据库,但我需要数据库。
<?php
$text="How to find and replace word in text from mysql database?";
$replaceWord=array( "text" => "sentence", "word" => "letter", "mysql" => "MySQL");
echo strtr($tekst, $replaceWord);
?>
我是间谍 “背景” 成为 “consentence”或“剑”变为“Sletter” – 2011-01-28 14:34:51