發(fā)表日期:2013.10.30 訪問(wèn)人數(shù):1192
成都馳創(chuàng)數(shù)碼—成品網(wǎng)站快速搭建發(fā)布網(wǎng)站非常方便,但在開(kāi)通后,聯(lián)系方式如果很多頁(yè)面都有,在排版模式下每一個(gè)頁(yè)面修改,耗時(shí)不說(shuō),可能還會(huì)存在大量遺漏沒(méi)有修改成功,下面方式可以快速批量修改聯(lián)系方式。成都網(wǎng)站建設(shè)方面的專家提醒大家:因操作直接操作數(shù)據(jù)庫(kù)且操作不可逆,請(qǐng)先備份數(shù)據(jù)庫(kù)數(shù)據(jù),然后再做以下操作!
1.登錄空間ftp,在wwwroot下建立replace.php
2,編輯這個(gè)文件輸入一下內(nèi)容:
<?php
/**
date:2013-05-12
function:批量替換數(shù)據(jù)庫(kù)中的聯(lián)系方式
**/
header("content-Type: text/html; charset=utf-8");
include_once("config.inc.php");
if(isset($_GET["act"]) && $_GET["act"] == "del" ){ //刪除測(cè)試文件
$filename=basename($_SERVER['PHP_SELF']);
@unlink($filename);
exit('Error:File Not Found!');
}
if(isset($_POST["submit"])){
$host=$dbHost;
$user=$dbUser; //數(shù)據(jù)庫(kù)用戶名
$passwd=$dbPass; //密碼
$db=$dbName; //數(shù)據(jù)庫(kù)名稱
$txt=$_POST["txt"]; //源字符串
$plustitle=$_POST["plustitle"]; //目標(biāo)字符串
$plusname=$_POST["plusname"]; //目標(biāo)字符串
$tables=$TablePre._base_plus;
$link= mysql_connect($host,$user,$passwd) or die('Could not connect: '.mysql_error() );
mysql_select_db( $db,$link ) or die ('can\'t use'. $db . mysql_error());
mysql_query ('SET NAMES utf8');
$sql1="UPDATE `$tables` SET text='$txt' where title='$plustitle' and pluslable='$plusname'";
if(mysql_query($sql1))
echo "<font color=red>替換成功!<br></font>";
else
echo "替換失敗:".mysql_error()."<br>";
mysql_close($link);
}
?>
<form method="post" action="">
<?
echo "數(shù)據(jù)庫(kù)地址: ".$dbHost ;
echo "<br/>數(shù)據(jù)庫(kù)名: ".$dbName;
echo "<br/>數(shù)據(jù)庫(kù)用戶名: ".$dbUser;
echo "<br/>數(shù)據(jù)庫(kù)密碼: ".$dbPass;
echo "<br/>表前綴: ".$TablePre;
?>
<br/>
插件標(biāo)題:<input name="plustitle" value="聯(lián)系我們" type="txt"><br/>
插件名:<input name="plusname" value="modText" type="txt"><br/>
替換內(nèi)容:<textarea name="txt" cols="50" rows="10" warp="virtual"></textarea> <br/>
<input type="submit" name="submit" value="開(kāi)始替換"><br/><br/>
<font color=red >操作不可逆,請(qǐng)先備份數(shù)據(jù)庫(kù)后再使用</font><br/>
<a href='?act=del'>刪除測(cè)試文件</a>
</form>
保存上傳到空間
3.訪問(wèn)這個(gè)http://您的域名/replace.php
按照提示完成批量替換,即可替換插件中為"modText"為聯(lián)系方式的內(nèi)容,個(gè)別頁(yè)面可能沒(méi)有修改 參照第四步修改
4.訪問(wèn)http://您的域名/admin.php,登錄后,點(diǎn)擊"網(wǎng)頁(yè)">>"網(wǎng)頁(yè)管理">>找到聯(lián)系方式,點(diǎn)擊后面的修改按鈕,完成相應(yīng)修改。
5.確認(rèn)修改完成后,切記刪除剛才建立的"replace.php".以免被他人知曉,破壞網(wǎng)站正常顯示
成都網(wǎng)站建設(shè)資料請(qǐng)點(diǎn)擊【成都網(wǎng)站建設(shè)公司介紹】
成都網(wǎng)站設(shè)計(jì)案例請(qǐng)點(diǎn)擊【成都網(wǎng)站設(shè)計(jì)案例】
免費(fèi)咨詢