织梦dedecms批量替换数据库数据,织梦技术
导读:织梦技术织梦技术在dede网站根目录下 新建 replace.php,内容如下: 然后 浏览器直接访问 http://www.genban.org/dedecms/replac织梦模板网织梦的模板。
在dede网站根目录下 新建 replace.php,内容如下:
然后 浏览器直接访问 http://www.genban.org/dedecms/replace.php 注意:此操作很危险,替换关键字时请小心,谨慎,最好先备份数据库
<?php require_once(dirname(__FILE__)."/include/common.inc.php"); $Arr = array("上海|重庆","广东|浙江"); //将 上海 替换 为 重庆,如果替换多个,可以自行添加 foreach($Arr as $v) { $vv = explode('|',$v); //addonarticle $rs1 = $dsql->ExecuteNoneQuery(" UPDATE `dede_addonarticle` SET `body` = REPLACE(`body`, '{$vv[0]}', '{$vv[1]}'); "); if(!$rs1) echo "替换{$vv[0]}失败<br />"; else echo "替换{$vv[0]}成功<br />"; //addondocask $rs2 = $dsql->ExecuteNoneQuery(" UPDATE `dede_addondocask` SET `body` = REPLACE(`body`, '{$vv[0]}', '{$vv[1]}'); "); if(!$rs2) echo "替换{$vv[0]}失败<br />"; else echo "替换{$vv[0]}成功<br />"; //archives $rs3 = $dsql->ExecuteNoneQuery(" UPDATE `dede_archives` SET `title` = REPLACE(`title`, '{$vv[0]}', '{$vv[1]}'), `shorttitle` = REPLACE(`shorttitle`, '{$vv[0]}', '{$vv[1]}'),`writer` = REPLACE(`writer`, '{$vv[0]}', '{$vv[1]}'),`source` = REPLACE(`source`, '{$vv[0]}', '{$vv[1]}'),`keywords` = REPLACE(`keywords`, '{$vv[0]}', '{$vv[1]}'),`description` = REPLACE(`description`, '{$vv[0]}', '{$vv[1]}'); "); if(!$rs3) echo "替换{$vv[0]}失败<br />"; else echo "替换{$vv[0]}成功<br />"; //arctype $rs4 = $dsql->ExecuteNoneQuery(" UPDATE `dede_arctype` SET `typename` = REPLACE(`typename`, '{$vv[0]}', '{$vv[1]}'), `defaultname` = REPLACE(`defaultname`, '{$vv[0]}', '{$vv[1]}'),`description` = REPLACE(`description`, '{$vv[0]}', '{$vv[1]}'),`keywords` = REPLACE(`keywords`, '{$vv[0]}', '{$vv[1]}'),`seotitle` = REPLACE(`seotitle`, '{$vv[0]}', '{$vv[1]}'),`cdede手机模板ontent` = REPLACE(`content`, '{$vv[0]}', '{$vv[1]}'); "); if(!$rs4) echo "替换{$vv[0]}失败<br />"; else echo "替换{$vv[0]}成功<br />"; //channeltype $rs5 = $dsql->ExecuteNoneQuery(" UPDATE `dede_channeltype` SET `typename` = REPLACE(`typename`, '{$vv[0]}', '{$vv[1]}'), `titlename` = REPLACE(`titlename`, '{$vv[0]}', '{$vv[1]}'); "); if(!$rs5) echo "替换{$vv[0]}失败<br />"; else echo "替换{$vv[0]}成功<br />"; //keywords $rs6 = $dsql->ExecuteNoneQuery(" UPDATE `dede_keywords` SET `keyword` = REPLACE(`keyword`, '{$vv[0]}', '{$vv[1]}'), `rpurl` = REPLACE(`rpurl`, '{$vv[0]}', '{$vv[1]}'); "); if(!$rs6) echo "替换{$vv[dede,模板0]}失败<br />"; else echo "替换{$vv[0]}成功<br />"; //myad &dede织梦模板nbsp; $rs7 = $dsql->ExecuteNoneQuery(" UPDATE `dede_myad` SET `tagname` = REPLACE(`tagname`, '{$vv[0]}', '{$vv[1]}'), `normbody` = REPLACE(`normbody`, '{$vv[0]}', '{$vv[1]}'), `expbody` = REPLACE(`expbody`, '{$vv[0]}', '{$vv[1]}'); "); if(!$rs7) echo "替换{$vv[0]}失败<br />"; else echo "替换{$vv[0]}成功<br />"; //mytag $rs8 = $dsql->ExecuteNoneQuery(" UPDATE `dede_mytag` SET `tagname` = REPLACE(`tagname`, '{$vv[0]}', '{$vv[1]}'), `normbody` = REPLACE(`normbody`, '{$vv[0]}', '{$vv[1]}'), `expbody` = REPLACE(`expbody`, '{$vv[0]}', '{$vv[1]}'); "); if(!$rs8) echo "替换{$vv[0]}失败<br />"; else echo "替换{$vv[0]}成功<br />"; //plus $rs9 = $dsql->ExecuteNoneQuery(" UPDATE `dede_plus` SET `plusname` = REPLACE(`plusname`, '{$vv[0]}', '{$vv[1]}'), `menustring` = REPLACE(`menustring`, '{$vv[0]}', '{$vv[1]}'), `mainurl` = REPLACE(`mainurl`, '{$vv[0]}', '{$vv[1]}'), `writer` = REPLACE(`writer`, '{$vv[0]}', '{$vv[1]}'); "); if(!$rs9) echo "替换{$vv[0]}失败<br />"; else echo "替换{$vv[0]}成功<br />"; //search_keywords $rs10 = $dsql->ExecuteNoneQuery(" UPDATE `dede_search_keywords` SET `keyword` = REPLACE(`keyword`, '{$vv[0]}', '{$vv[1]}'), `spwords` = REPLACE(`spwords`, '{$vv[0]}', '{$vv[1]}'); "); if(!$rs10) echo "替换{$vv[0]}失败<br />"; else echo "替换{$vv[0]}成功<br />"; //tagindex $rs11 = $dsql->ExecuteNoneQuery(" UPDATE `dede_tagindex` SET `tag` = REPLACE(`tag`, '{$vv[0]}', '{$vv[1]}'); "); if(!$rs11) echo "替换{$vv[0]}失败<br />"; else echo "替换{$vv[0]}成功<br />"; //taglist $rs12 = $dsql->ExecuteNoneQuery(" UPDATE `dede_taglist` SET `tag` = REPLACE(`tag`, '{$vv[0]}', '{$vv[1]}'); "); if(!$rs12) echo "替换{$vv[0]}失败<br />"; else echo "替换{$vv[0]}成功<br />"; //vote $rs13 = $dsql->ExecuteNoneQuery(" UPDATE `dede_vote` SET `votename` = REPLACE(`votename`, '{$vv[0]}', '{$vv[1]}'), `votenote` = REPLACE(`votenote`, '{$vv[0]}', '{$vv[1]}'); "); if(!$rs13) echo "替换{$vv[0]}失败<br />"; else echo "替换{$vv[0]}成功<br />"; //ask $rs14 = $dsql->ExecuteNoneQuery(" UPDATE `dede_feedback` SET `feedtitle` = REPLACE(`feedtitle`, '{$vv[0]}', '{$vv[1]}'), `msg` = REPLACE(`msg`, '{$vv[0]}', '{$vv[1]}'); "); if(!$rs14) echo "替换{$vv[0]}失败<br />"; else echo "替换{$vv[0]}成功<br />"; } ?>相关织梦模板网织梦的模板。声明: 本文由我的SEOUC技术文章主页发布于:2023-07-19 ,文章织梦dedecms批量替换数据库数据,织梦技术主要讲述批量,标签,织梦网站建设源码以及服务器配置搭建相关技术文章。转载请保留链接: https://www.seouc.com/article/web_30013.html