发现最近上传的附件数量越来越多,但刚开始写日记时跟以前作论坛的时候那样,没有意识到这点,就没有设定上传附件按月存放,只好从现在开始了。
不过以前有部分文件还是想重新按月存放,因为这些文件都是有日期的,如行情评点的每天指数分时图。本来已经在后台重新按日期目录搬好了,剩下的就是手动修改数据库。找了一下资料,发现发现方法如下:
使用replace函数直接替换mysql数据库中某字段中的特定字符
说明:
table_name —— 表的名字
field_name —— 字段名
from_str —— 需要替换的字符串
to_str —— 替换成的字符串
目的是为了直接用sql操作数据库修改字段中的某些字串!
根据上面的语法,试了一下,在程序后台运行 MySQL 语句如下:
update `boblog_blogs` set `content`=replace(`content`,'/sh-index-200707','/200707/sh-index-200707') WHERE `content` LIKE '%/sh-index-200707%';
update `boblog_blogs` set `content`=replace(`content`,'/sh-index-200708','/200708/sh-index-200708') WHERE `content` LIKE '%/sh-index-200708%';
update `boblog_blogs` set `content`=replace(`content`,'/sh-index-200709','/200709/sh-index-200709') WHERE `content` LIKE '%/sh-index-200709%';
update `boblog_blogs` set `content`=replace(`content`,'/sh-index-200710','/200710/sh-index-200710') WHERE `content` LIKE '%/sh-index-200710%';
update `boblog_blogs` set `content`=replace(`content`,'/sz-index-200707','/200707/sz-index-200707') WHERE `content` LIKE '%/sz-index-200707%';
update `boblog_blogs` set `content`=replace(`content`,'/sz-index-200708','/200708/sz-index-200708') WHERE `content` LIKE '%/sz-index-200708%';
update `boblog_blogs` set `content`=replace(`content`,'/sz-index-200709','/200709/sz-index-200709') WHERE `content` LIKE '%/sz-index-200709%';
update `boblog_blogs` set `content`=replace(`content`,'/sz-index-200710','/200710/sz-index-200710') WHERE `content` LIKE '%/sz-index-200710%';
修改成功!虽然运行后有 error 出错信息,但没有关系,重新打开相关页面后,图片显示正常。呵呵!
不过以前有部分文件还是想重新按月存放,因为这些文件都是有日期的,如行情评点的每天指数分时图。本来已经在后台重新按日期目录搬好了,剩下的就是手动修改数据库。找了一下资料,发现发现方法如下:
使用replace函数直接替换mysql数据库中某字段中的特定字符
UPDATE `table_name` SET `field_name` = replace (`field_name`,'from_str','to_str') WHERE `field_name` LIKE '%from_str%'
说明:
table_name —— 表的名字
field_name —— 字段名
from_str —— 需要替换的字符串
to_str —— 替换成的字符串
目的是为了直接用sql操作数据库修改字段中的某些字串!
根据上面的语法,试了一下,在程序后台运行 MySQL 语句如下:
update `boblog_blogs` set `content`=replace(`content`,'/sh-index-200707','/200707/sh-index-200707') WHERE `content` LIKE '%/sh-index-200707%';
update `boblog_blogs` set `content`=replace(`content`,'/sh-index-200708','/200708/sh-index-200708') WHERE `content` LIKE '%/sh-index-200708%';
update `boblog_blogs` set `content`=replace(`content`,'/sh-index-200709','/200709/sh-index-200709') WHERE `content` LIKE '%/sh-index-200709%';
update `boblog_blogs` set `content`=replace(`content`,'/sh-index-200710','/200710/sh-index-200710') WHERE `content` LIKE '%/sh-index-200710%';
update `boblog_blogs` set `content`=replace(`content`,'/sz-index-200707','/200707/sz-index-200707') WHERE `content` LIKE '%/sz-index-200707%';
update `boblog_blogs` set `content`=replace(`content`,'/sz-index-200708','/200708/sz-index-200708') WHERE `content` LIKE '%/sz-index-200708%';
update `boblog_blogs` set `content`=replace(`content`,'/sz-index-200709','/200709/sz-index-200709') WHERE `content` LIKE '%/sz-index-200709%';
update `boblog_blogs` set `content`=replace(`content`,'/sz-index-200710','/200710/sz-index-200710') WHERE `content` LIKE '%/sz-index-200710%';
修改成功!虽然运行后有 error 出错信息,但没有关系,重新打开相关页面后,图片显示正常。呵呵!
优酷网 YouKu.com 视频下载连接解码
【转载】如何看出男人真心爱上你了

2008/01/21 01:48 | by
分类