|
|
@ -228,6 +228,7 @@ class Index extends CI_Controller {
|
|
|
|
require_once "PHPExcel/IOFactory.php";
|
|
|
|
require_once "PHPExcel/IOFactory.php";
|
|
|
|
$phpExcel = PHPExcel_IOFactory::load($path.$filename);
|
|
|
|
$phpExcel = PHPExcel_IOFactory::load($path.$filename);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//创建返回的数组
|
|
|
|
//创建返回的数组
|
|
|
|
$data = [];
|
|
|
|
$data = [];
|
|
|
|
foreach ($phpExcel->getSheetNames() as $key=>$destination){
|
|
|
|
foreach ($phpExcel->getSheetNames() as $key=>$destination){
|
|
|
@ -236,20 +237,20 @@ class Index extends CI_Controller {
|
|
|
|
$data[$key]->list_name = array();
|
|
|
|
$data[$key]->list_name = array();
|
|
|
|
$data[$key]->list_data = array();
|
|
|
|
$data[$key]->list_data = array();
|
|
|
|
//循环获取每个表格的行/列数
|
|
|
|
//循环获取每个表格的行/列数
|
|
|
|
$row = $phpExcel->getActiveSheet()->getHighestRow();
|
|
|
|
$row = $phpExcel->getSheet($key)->getHighestRow();
|
|
|
|
$column = $phpExcel->getActiveSheet()->getHighestColumn();
|
|
|
|
$column = $phpExcel->getSheet($key)->getHighestColumn();
|
|
|
|
$j = 0;
|
|
|
|
$j = 0;
|
|
|
|
// 行数循环
|
|
|
|
// 行数循环
|
|
|
|
for ($i = 1; $i <= $row; $i++) {
|
|
|
|
for ($i = 1; $i <= $row; $i++) {
|
|
|
|
// 列数循环
|
|
|
|
// 列数循环
|
|
|
|
for ($c = 'A'; $c <= $column; $c++) {
|
|
|
|
for ($c = 'A'; $c <= $column; $c++) {
|
|
|
|
if($phpExcel->getActiveSheet($key)->getCell('A' . $i)->getValue() == ''){
|
|
|
|
if($phpExcel->getSheet($key)->getCell('A' . $i)->getValue() == ''){
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}else{
|
|
|
|
}else{
|
|
|
|
if($i == 1){
|
|
|
|
if($i == 1){
|
|
|
|
array_push($data[$key]->list_name,$phpExcel->getActiveSheet($key)->getCell($c . $i)->getValue());
|
|
|
|
array_push($data[$key]->list_name,$phpExcel->getSheet($key)->getCell($c . $i)->getValue());
|
|
|
|
}else{
|
|
|
|
}else{
|
|
|
|
$data[$key]->list_data[$j][] = $phpExcel->getActiveSheet($key)->getCell($c . $i)->getValue();
|
|
|
|
$data[$key]->list_data[$j][] = $phpExcel->getSheet($key)->getCell($c . $i)->getValue();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -291,6 +292,7 @@ class Index extends CI_Controller {
|
|
|
|
set_time_limit(0);
|
|
|
|
set_time_limit(0);
|
|
|
|
$url = $this->input->get_post('url');
|
|
|
|
$url = $this->input->get_post('url');
|
|
|
|
$destination = $this->input->get_post('destination');
|
|
|
|
$destination = $this->input->get_post('destination');
|
|
|
|
|
|
|
|
$html_num = $this->input->get_post('html_num');
|
|
|
|
|
|
|
|
|
|
|
|
//$url = 'https://www.tripadvisor.com/ShowUserReviews-g294212-d4006739-r666168101-The_Trippest_Mini_Group_Tours-Beijing.html';
|
|
|
|
//$url = 'https://www.tripadvisor.com/ShowUserReviews-g294212-d4006739-r666168101-The_Trippest_Mini_Group_Tours-Beijing.html';
|
|
|
|
$destination = 'tp_Beijing';
|
|
|
|
$destination = 'tp_Beijing';
|
|
|
@ -307,6 +309,8 @@ class Index extends CI_Controller {
|
|
|
|
$meta_inner = $html_object->find('.meta_inner');
|
|
|
|
$meta_inner = $html_object->find('.meta_inner');
|
|
|
|
|
|
|
|
|
|
|
|
foreach($meta_inner as $detail_info){
|
|
|
|
foreach($meta_inner as $detail_info){
|
|
|
|
|
|
|
|
//记录该条记录的id
|
|
|
|
|
|
|
|
$detail_data->html_id = $html_num;
|
|
|
|
//获取评论者帐号
|
|
|
|
//获取评论者帐号
|
|
|
|
foreach($detail_info->find('.info_text') as $review_name){
|
|
|
|
foreach($detail_info->find('.info_text') as $review_name){
|
|
|
|
$detail_data->review_name = $review_name->first_child()->innertext;
|
|
|
|
$detail_data->review_name = $review_name->first_child()->innertext;
|
|
|
|