1,在dede根目录下新建关键字列表txt---> key.txt,内容格式如下:

 

关键字1|链接网址1

关键字2|链接网址2

关键字3|链接网址3

关键字4|链接网址4

 

2,在dede根目录下新建 update_keyword.php,内容如下:

 

<?php  

    require_once(dirname(__FILE__)."/include/common.inc.php");<p>       

    $sql = " truncate table `dede_keywords` "; //注意:此处删除表,如果只是追加关键字,请注释此处  

    if(!$dsql->ExecuteNoneQuery($sql)) echo "错误!<br />";  

    $convertedrows = 0;  

 

    $m_file = "key.txt";  

    //读取key.txt  

    $fp = fopen($m_file,'r');  

    $allkey = fread($fp,filesize($m_file));  

    $allkeys = explode("\n", $allkey);  

    fclose($fp);  

    //print_r($allkeys);  

    foreach($allkeys as $keys)  

    {  

        $newkey = explode('|', $keys);  

        $keyword = trim($newkey['0']);  

        $rpurl = trim($newkey['1']);  

        $rank = trim($newkey['2']);  

        //echo $keyword."--".$rpurl."--".$rank;  

        //exit;  

        $query = "INSERT INTO `51_keywords`(keyword, rank, sta, rpurl) VALUES ('$keyword', '$rank', '1', '$rpurl')";  

        if(!$dsql->ExecuteNoneQuery($query)) echo "插入错误!<br />";  

        $convertedrows ++;  

        echo '插入第'.$convertedrows.'个关键字--->'.$keyword.'<br>';  

    }  

    echo '共插入'.$convertedrows.'个关键字';  

    exit();  

?> 

3,浏览器直接访问 update_keyword.php