代码拉取完成,页面将自动刷新
<?php
header("Content-Type:text/html;charset=utf-8");
include_once "util.php";
include_once "diseasePages.php";
include_once "symptonPages.php";
/**
* @var array $diseasePages
* @var array $symptonPages
*/
$alias = []; $department = []; $symptons = []; $totalSympton = []; $position = [];
$i = 1; $total = count($diseasePages);
foreach ($diseasePages as $name => $url) {
$content = getHTML($url . "jbzs/");
$zztzContent = getHTML($url . "zztz/");
//抽别名
preg_match("/<dd><i>别名:<\/i> (.*)<\/dd>/U", $content, $match);
$alias[$name] = explode(",", str_replace(",", ",", $match[1]));
//抽相关症状
preg_match("/相关症状.*<\/dd>/siU", $zztzContent, $match);
preg_match_all("/http:\/\/jbk.39.net\/zhengzhuang\/\w+\/.*title=\"(.*)\"/siU", $match[0], $matches);
$symptons[$name] = $matches[1];
//抽症状库
foreach ($matches[1] as $sympton) {
if (array_search($sympton, $totalSympton) == false) $totalSympton[] = $sympton;
}
//抽部位
preg_match("/发病部位.*<\/dd>/siU", $content, $match);
preg_match_all("/<a href='\/bw\/\w+\/'>(.*)<\/a>/U", $match[0], $matches);
$position[$name] = $matches[1];
//抽科室
preg_match("/就诊科室.*<\/dd>/siU", $content, $departmentContent);
preg_match_all("/href='\/bw\/\w+\/'>(.*)<\/a>/U", $departmentContent[0], $matches);
$department[$name] = $matches[1];
echo "Disease Page Analyzed: {$i}/{$total}\n"; $i++;
}
$i = 1; $total = count($symptonPages);
foreach ($symptonPages as $name => $url) {
$content = getHTML($url . "zzqy/");
if (!in_array($name, $totalSympton)) $totalSympton[] = $name;
//抽症状相关疾病
preg_match("/可能疾病.*<\/table>/siU", $content, $possibleDiseases);
preg_match_all("/http:\/\/jbk.39.net\/\w+\/.*title=\"(.*)\"/U", $possibleDiseases[0], $matches);
foreach ($matches[1] as $disease) {
if (!isset($symptons[$disease])) $symptons[$disease] = [];
if (!in_array($name, $symptons[$disease])) $symptons[$disease][] = $name;
}
echo "Sympton Page Analyzed: {$i}/{$total}\n"; $i++;
}
dumpVariableToFile($alias, "result/alias.php", "alias");
dumpVariableToFile($department, "result/department.php", "department");
dumpVariableToFile($symptons, "result/symptons.php", "symptons");
dumpVariableToFile($totalSympton, "result/totalSympton.php", "totalSympton");
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。