帝国CMS批量提取第一张图片作为标题缩略图
- 分类:建站教程 发布时间:2020-03-05 17:44:02 阅读:
在执行SQL语句前请先备份数据库!
位置:后台>系统>备份与恢复数据>执行SQL语句
新闻正文字段作为主表的情况用以下语句:
update phome_ecms_news set titlepic =concat(replace(SUBSTRING_INDEX(SUBSTRING_INDEX(newstext, 'src=', -1),'.gif',1),'"',''),'.gif') where newstext like '%.gif%' and titlepic='';
update phome_ecms_news set titlepic =concat(replace(SUBSTRING_INDEX(SUBSTRING_INDEX(newstext, 'src=', -1),'.jpg',1),'"',''),'.gif') where newstext like '%.jpg%' and titlepic='';
update phome_ecms_news set titlepic =concat(replace(SUBSTRING_INDEX(SUBSTRING_INDEX(newstext, 'src=', -1),'.png',1),'"',''),'.png') where newstext like '%.png%' and titlepic='';
新闻正文字段作为副表的情况用以下语句:
update [!db.pre!]ecms_news_data_1 a, [!db.pre!]ecms_news b set b.titlepic=concat(replace(SUBSTRING_INDEX(SUBSTRING_INDEX(a.newstext, 'src=', -1),'.gif',1),'"',''),'.gif') where a.newstext like '%.gif%' and b.titlepic='' and a.id=b.id;
update [!db.pre!]ecms_news_data_1 a, [!db.pre!]ecms_news b set b.titlepic=concat(replace(SUBSTRING_INDEX(SUBSTRING_INDEX(a.newstext, 'src=', -1),'.jpg',1),'"',''),'.jpg') where a.newstext like '%.jpg%' and b.titlepic='' and a.id=b.id;
update [!db.pre!]ecms_news_data_1 a, [!db.pre!]ecms_news b set b.titlepic=concat(replace(SUBSTRING_INDEX(SUBSTRING_INDEX(a.newstext, 'src=', -1),'.png',1),'"',''),'.png') where a.newstext like '%.png%' and b.titlepic='' and a.id=b.id;
- 猜您喜欢
- SEO新站如何优化? 03-10
- SEO是什么?为什么要做seo?seo要如何做? 01-03
- 百度算法合集至2019 03-06
- 如何购买域名和选择空间? 04-10
- 帝国cms怎么做下拉菜单导航 03-13
- 帝国后台怎么更改界面?更改目录 03-26
- 什么是SEO优化? 01-03
- 百度绿萝算法2.0介绍 04-02
- seo是什么意思 01-03
- 帝国CMS批量提取第一张图片作为标题缩略图 03-05
- 相关推荐
- 帝国cms怎么做下拉菜单导航 03-13
- 百度算法合集至2019 03-06
- 帝国CMS如何更改浏览器窗口图标? 03-06
- 帝国CMS批量提取第一张图片作为标题缩略图 03-05