您好,登錄后才能下訂單哦!
// exec('mongoexport -h 192.168.6.97 --port 40000 -d fenjianlidb -c fenjianli -f "meta_info.file_path" -q "{\'create_time\':{\'$gte\': \'1487088000\',\'$lte\': \'1487644200\'}}" -o ' . $save_path .'middle.txt', $ret); //window平臺(tái)
//php 執(zhí)行
exec('mongoexport -h 192.168.6.97 --port 40000 -d zhengliangdb -c newzengliang -f "meta_info.file_path" -q \'{create_time:{$gte: 1487645408,$lte: 1487646251}}\' -o /data/work_time/work0221/testMid/middle.txt', $ret); //Linux 成功 (切記轉(zhuǎn)移) mongoexport --help 查看
--------------------------------------測(cè)試代碼-----------------------------------------
<?php
/**
* @Author: lixiaozhu
* @Date: 2016-09-21 12:51:55
* @Last Modified by: lixiaozhu
* @Last Modified time: 2017-01-20 18:50:24
*/
set_time_limit(0);
// $save_path = 'D:/phpStudy/WWW/test01/mongo/test0221/';
$save_path = '/data/work_time/work0221/testMid/';
//中間件
// exec('mongoexport -h 192.168.6.97 --port 40000 -d fenjianlidb -c fenjianli -f "meta_info.file_path" -q "{\'create_time\':{\'$gte\': \'1487088000\',\'$lte\': \'1487644200\'}}" -o ' . $save_path .'middle.txt', $ret); //window平臺(tái)
//php 執(zhí)行
exec('mongoexport -h 192.168.6.97 --port 40000 -d zhengliangdb -c newzengliang -f "meta_info.file_path" -q \'{create_time:{$gte: 1487645408,$lte: 1487646251}}\' -o /data/work_time/work0221/testMid/middle.txt', $ret); //Linux 成功
$groups = array(
'group1' => 'http://192.168.6.49/',
'group2' => 'http://192.168.6.50/',
);
$content = file_get_contents($save_path . 'middle.txt');
$list = preg_split('/\s+/', $content);
$prefix = date('YmdH');
foreach ($list as $key => $item) {
echo $key++, PHP_EOL;
$item = json_decode($item, true);
$file_path = trim($item['meta_info']['file_path']);
$group = substr($file_path, 0, 6);
if (isset($groups[$group])) {
$url = $groups[$group] . $file_path;
$content = file_get_contents($url);
if(false !== strpos($content,'zhaopin.com')){ //可能會(huì)有 zhaopin.cn localhost/qiaoda/zhilian/z1.html
error_log($url . PHP_EOL, 3, $save_path . $prefix .'_zhilian.txt');
} elseif (false !== strpos($content,'51job.com')){
error_log($url . PHP_EOL, 3, $save_path . $prefix .'_51job.txt');
} elseif (false !== strpos($content,'liepin.com')){
error_log($url . PHP_EOL, 3, $save_path . $prefix .'_liepin.txt');
} elseif (false !== strpos($content,'ganji.com')){
error_log($url . PHP_EOL, 3, $save_path . $prefix . '_ganji.txt');
} elseif (false !== strpos($content, '58.com')){
error_log($url . PHP_EOL, 3, $save_path . $prefix . '_58tongchen.txt');
} elseif (false !== strpos($content, 'chinahr.com')){
error_log($url . PHP_EOL, 3, $save_path . $prefix . '_YCjianli.txt');
} else {
error_log($url . PHP_EOL, 3, $save_path . $prefix . '_other.txt');
}
} else {
echo 'mubanFileError';
error_log($file_path . PHP_EOL, 3, $save_path . $prefix . '_mubanFileError.txt');
}
unset($content);
}
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。