旧网站新导入

mobile-first
赵鹏 6 years ago
parent 211f451503
commit 4d4b8c3425

@ -563,6 +563,56 @@ class webgetbokun extends CI_Controller
}
/** 读取旧网站的XML信息存入信息平台 */
/**
* @description:读取XML信息存入信息平台
* @param {type} $category:如果设置了类别,那么只保存该类别的信息。
* @return:
* @Date Changed:
*/
function getOldXML($category=""){
$xmlParent = "278001169" ; //父类ID 本地
// $xmlParent = "278013201" ; //父类 网前
//读取XML类型
$appPath = $_SERVER['DOCUMENT_ROOT'];
$XmlPath = $appPath."/application/third_party/tpmanage/post0702.xml";
$xml = simplexml_load_file($XmlPath);
// print_r($xml);
$Items = $xml->channel->item;
$i=0;
//循环保存
foreach ($Items as $xmlItem) {
// if ($i==0){
// $content = $xmlItem->children("content",true);
// $content2 = (string)($content->encoded);
// print_r($content2);
// return;
// }
$title = $xmlItem->title;
$link = str_replace("https://www.trippest.com","",$xmlItem->link);
$content = (string)$xmlItem->children("content",true)->encoded;
$content = str_replace("https://www.trippest.com/wp-content/uploads/","/images/uploads/",$content); //替换图片显示地址
//入信息平台
$title = str_replace("—","-",$title);
$this->tpBokun_model->ic_title = $title;
$this->tpBokun_model->ic_url_title = $title;
$this->tpBokun_model->ic_url = $link;
$this->tpBokun_model->ic_content = $content;
$tempData = json_decode($this->tpBokun_model->addInfo($xmlParent));
$i=$i+1;
// print $i.":".$content ."\r\n";
}
echo "导入完成" ;
//保存
}
/** 这里是在cht的信息平台运行的接口 */
/**

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save