例子:
代码如下:
update 你的表前缀_archives set `litpic`=replace(litpic, 'http://upload.jb51.net', '/uploads') WHERE id=1466
我们来执行看看结果,成功执行1个SQL语句,好现在我们来查询一下执行结果是不是我们想要的,再执行:
代码如下:
select litpic from 你的表前缀_archives where id =1466;
确定执行提示:
运行SQL:
代码如下:
select litpic from 你的表前缀_archives where id =1466;共有1条记录,最大返回100条.
记录:1
litpic:/uploads/allimg/c090405/123Y13349440-1SH6.jpg
看提示没有错误,我们在地址栏看看图片正确,查看是没有问题了,现在我们来批量替换.
代码如下:
select litpic from 你的表前缀_archives where litpic like '%http://upload.jb51.net%'
这样我们查一下是为了防止后面替换不会替换没有http://upload.jb51.net了,也防止了sql出错导致数据库全部替换掉了.
代码如下:
update 你的表前缀_archives set `litpic`=replace(litpic, 'http://upload.jb51.net', '/uploads') where litpic like '%http://upload.jb51.net%'
成功执行1个SQL语句,我们再查一下看.
运行SQL:
代码如下:
select litpic from 你的表前缀_archives where litpic like '%http://upload.jb51.net%'无返回记录!
希望本文所述对大家的dedecms建站有所帮助。
标签:织梦DedeCMS
相关阅读 >>
更多相关阅读请进入《织梦DedeCMS》频道 >>
相关推荐
评论
管理员已关闭评论功能...
- 欢迎访问木庄网络博客
- 可复制:代码框内的文字。
- 方法:Ctrl+C。