我的知识记录

请问帝国CMS批量正文提取第一张图片为标题图片

  1. 新闻正文字段作为主表的情况

    • 使用以下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),'"',''),'.jpg') 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='';
  2. 新闻正文字段作为副表的情况

    • 使用以下SQL语句:
      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;

       

标签:图片帝国的黎明-图片帝国主义奴役这片东方-图片帝王-帝国 图片-帝国cms多图上传插件-

更新时间:2025-04-11 00:39:51

上一篇:请问帝国CMS更改域名后信息地址中的域名不变解决方法

下一篇:请问宝塔账号密码错误,之前修改过但无法登录怎么办?