当我们做大型网站时候,数据量通常也比较庞大,如果我们想修改所有新闻内容中包含的某个词,或者某个图片,甚至是某个符号时,我们如果手动来更新,不太现实,那我们可以用批量替换操作mysql,以下语句站长新测无误,可直接复制替换关键值字段;
----------------mysql 语法开始-----------------
update bole_diy_article set content= replace(content, '/uploads/image/zimeiti/自媒体', '/uploads/image/zimeiti/zimeiti');
where id >= 100;
----------------mysql 语法结束-----------------
----------------七牛云 语法开始-----------------
update yunu_content set pic= replace(pic, '/uploads/', 'http://img.bolewangluo.cn/uploads/');
update yunu_diy_article set content= replace(content, '/uploads/', 'http://img.bolewangluo.cn/uploads/');
update yunu_diy_image set content= replace(content, '/uploads/', 'http://img.bolewangluo.cn/uploads/');
update yunu_diy_image set piclist= replace(piclist, '/uploads/', 'http://img.bolewangluo.cn/uploads/');
update yunu_diy_product set piclist= replace(piclist, '/uploads/', 'http://img.bolewangluo.cn/uploads/');
----------------七牛云 语法结束-----------------
注意事项:
1、bole_diy_article为mysql数据库表
2、content为bole_diy_article表中的字段
3、/uploads/image/zimeiti/自媒体为content字段中要替换的内容
4、/uploads/image/zimeiti/zimeiti为content字段中替换后的内容
5、where id >= 100为要替换内容id的范围,不写则为全部数据替换
----------------HTTPS 语法结束-----------------
update mb118_content set pic= replace(pic, 'http://img.bolewangluo.cn/uploads/', 'https://www.bolewangluo.cn/uploads/');
update mb118_diy_article set content= replace(content, 'http://img.bolewangluo.cn/uploads/', 'https://www.bolewangluo.cn/uploads/');
update mb118_diy_image set content= replace(content, 'http://img.bolewangluo.cn/uploads/', 'https://www.bolewangluo.cn/uploads/');
update mb118_diy_image set piclist= replace(piclist, 'http://img.bolewangluo.cn/uploads/', 'https://www.bolewangluo.cn/uploads/');
update mb118_diy_product set piclist= replace(piclist, 'http://img.bolewangluo.cn/uploads/', 'https://www.bolewangluo.cn/uploads/');
update mb118_banner set pic= replace(pic, 'http://img.bolewangluo.cn/uploads/', 'https://www.bolewangluo.cn/uploads/');
update mb118_block set content= replace(content, 'http://img.bolewangluo.cn/uploads/', 'https://www.bolewangluo.cn/uploads/');
update mb118_category set pic= replace(pic, 'http://img.bolewangluo.cn/uploads/', 'https://www.bolewangluo.cn/uploads/');
update mb118_category set content= replace(content, 'http://img.bolewangluo.cn/uploads/', 'https://www.bolewangluo.cn/uploads/');
*注* Logo单独手动修改,注意字段名称mb118 or yunu
----------------HTTPS 语法结束-----------------
请立即点击咨询我们或拨打咨询热线: 18031152740,我们会详细为你一一解答你心中的疑难。业务经理在线