|
|
@@ -14,19 +14,19 @@ $word = $_POST['word'];
|
|
|
$ql = QueryList::getInstance();
|
|
|
//$ql->use(Baidu::class);
|
|
|
//or Custom function name
|
|
|
-$ql->use(Baidu::class, 'baidu',"M");
|
|
|
- $baidu = $ql->baidu(10);
|
|
|
+$ql->use(Baidu::class, 'baidu', "M");
|
|
|
+$baidu = $ql->baidu(10);
|
|
|
$str = "site:" . $domain;
|
|
|
if ($word) {
|
|
|
$origin_str = [';', ';', ',', ',', ' ', "\r\n"];
|
|
|
$des_str = [',', ',', ',', ',', ',', ','];
|
|
|
$word = str_replace($origin_str, $des_str, $word);
|
|
|
- $word=explode(",", $word);
|
|
|
+ $word = explode(",", $word);
|
|
|
}
|
|
|
|
|
|
$header = [[
|
|
|
- '标题',
|
|
|
- '链接',
|
|
|
+ 'title' => '标题',
|
|
|
+ 'link' => '链接'
|
|
|
]];
|
|
|
$p = 0;
|
|
|
$spreadsheet = new Spreadsheet();
|
|
|
@@ -39,16 +39,16 @@ foreach ($word as $item) {
|
|
|
for ($i = 1; $i <= $page; $i++) {
|
|
|
$data = $searcher->page($i, true);
|
|
|
$data = json_decode(json_encode($data), true);
|
|
|
- $data=array_filter($data);
|
|
|
+ $data = array_filter($data);
|
|
|
$result = array_merge($result, $data);
|
|
|
}
|
|
|
$act_sheet = $spreadsheet->getActiveSheet();
|
|
|
$result = array_merge($header, $result);
|
|
|
- $title="关键词:".$item;
|
|
|
+ $title = "关键词:" . $item;
|
|
|
if ($p == 0) {
|
|
|
$act_sheet->setTitle($title);
|
|
|
$act_sheet->fromArray($result);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
$sheet = new Worksheet();
|
|
|
$sheet->setTitle($title);
|
|
|
$sheet->fromArray($result);
|
|
|
@@ -66,7 +66,7 @@ try {
|
|
|
header("Content-Type:application/vnd.ms-execl");
|
|
|
header("Content-Type:application/octet-stream");
|
|
|
header("Content-Type:application/download");
|
|
|
- header('Content-Disposition:attachment;filename="site数据-['.$domain.'].xlsx"');
|
|
|
+ header('Content-Disposition:attachment;filename="site数据-[' . $domain . '].xlsx"');
|
|
|
header("Content-Transfer-Encoding:binary");
|
|
|
$writer->save('php://output');
|
|
|
$spreadsheet->disconnectWorksheets();
|