} $checkvolume = false; //对比章节时候要不要匹配卷名(默认不要) $vorder = 0; $corder = 0; //去掉分卷中的文章名 foreach ($fromrows as $key => $value) { $fromrows[$key]['vname'] = trim(str_replace($myarticlename, '', $fromrows[$key]['vname'])); if ($value['type'] > 0) { $fromrows[$key]['title'] = $fromrows[$key]['vname']; $vorder++; $corder = 0; } else { $corder++; if ($vorder > 1 && $corder == 1) { $tempary = jieqi_splitchapter($fromrows[$key]['vname'] . ' ' . $fromrows[$key]['title']); //分卷大于一,章节从一开始的情况 if ($tempary['vid'] > 1 && $tempary['cid'] == 1) { $checkvolume = true; } } } } foreach ($torows as $key => $value) { $torows[$key]['vname'] = trim(str_replace($myarticlename, '', $torows[$key]['vname'])); if ($value['type'] > 0) { $torows[$key]['title'] = $torows[$key]['vname']; } } //比较更新内容 $fp=frompoint, $tp=topoint $fromnum = count($fromrows);
function jieqi_equichapter($chapter1, $chapter2) { $retfrom = array(' ', ' ', '<', '>', '【', '】', '[', ']', '[', ']', '(', ')', '(', ')', 'T', '图', '求票'); if ($chapter1 == $chapter2) { return true; } elseif (str_replace($retfrom, '', $chapter1) == str_replace($retfrom, '', $chapter2)) { return true; } else { $tmpary1 = jieqi_splitchapter($chapter1); $tmpary2 = jieqi_splitchapter($chapter2); if ($tmpary1['pnum'] == $tmpary2['pnum'] && $tmpary1['cname'] == $tmpary2['cname']) { return true; } else { return false; } } }