【发布时间】:2011-12-23 07:38:04
【问题描述】:
我有:
表_A:
ID | post_content
1 |这是bla bla url1.com
2 |这是另一个文本 blah blah url2.com
3 |这是第三个文本 blah blah url3.com
4 | wordpress博文这样的文章文本很多,里面匹配的字符串比较多
5 | ...
*Table_B:*
字符串A |字符串B
url1.com |链接1.com
url2.com |链接2.com
url3.com |链接3.com
...url600 | ...链接600
表 A 中的 post_content 是 wordpress 文章文本,可能在此文本中的某处包含一些与 StringsA 中的字符串匹配的字符串。
我需要用 StringsB 中的相应字符串替换 post_content 列中的那些字符串,所以它看起来像这样:
表_A:
ID | post_content
1 |这是bla bla link1.com
2 |这是另一个文本 blah blah link2.com
3 |这是第三个文本 blah blah link3.com
4 | wordpress博文这样的文章文本很多,里面匹配的字符串比较多
5 | ...
最简单的方法是什么?我可以只使用 MySQL,还是应该使用 PHP 脚本?
【问题讨论】:
标签: php mysql string replace find