diff --git a/application/controllers/infofix.php b/application/controllers/infofix.php index 196c4b5f..a6337f97 100644 --- a/application/controllers/infofix.php +++ b/application/controllers/infofix.php @@ -31,9 +31,13 @@ class infofix extends CI_Controller foreach ($rs as $info) { $keycount = array(); foreach ($keys as $key) { - $pos1 = stripos($info->ic_url, $key); - $pos2 = stripos($info->ic_content, $key); - array_push($keycount, array('key' => $key, 'pos1' => $pos1, 'pos2' => $pos2)); + $pos_url = stripos($info->ic_url, $key); + $sub_url = $info->ic_url == $key ? $info->ic_url : ''; + $pos_content = stripos($info->ic_content, $key); + $sub_content = '[...' . substr($info->ic_content, $pos_content - 20, strlen($key) + 20 * 2) . '...]'; + if ($pos_url !== false || $pos_content !== false) { + array_push($keycount, array('key' => $key, 'sub_url' => $sub_url, 'sub_content' => $sub_content)); + } } $info->ic_content = $keycount; }