|
|
|
@ -16,7 +16,7 @@ class infofix extends CI_Controller
|
|
|
|
|
function list_info_by_keys($site = '', $keys = [])
|
|
|
|
|
{
|
|
|
|
|
$site = 'cht';
|
|
|
|
|
$keys = ['/beijing/', '/yangshuo/'];
|
|
|
|
|
$keys = ['/beijing/', '/shanghai/'];
|
|
|
|
|
|
|
|
|
|
// 容错
|
|
|
|
|
if (empty($site) || empty($keys)) {
|
|
|
|
@ -33,9 +33,16 @@ class infofix extends CI_Controller
|
|
|
|
|
foreach ($keys as $key) {
|
|
|
|
|
$pos_url = stripos($info->ic_url, $key);
|
|
|
|
|
$sub_url = $info->ic_url == $key ? $info->ic_url : '';
|
|
|
|
|
|
|
|
|
|
$pos_content = 0;
|
|
|
|
|
$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) {
|
|
|
|
|
$sub_content = array();
|
|
|
|
|
while ($pos_content) {
|
|
|
|
|
array_push($sub_content, '[...' . substr($info->ic_content, $pos_content - 20, strlen($key) + 20 * 2) . '...]');
|
|
|
|
|
$pos_content = stripos($info->ic_content, $key, $pos_content + strlen($key));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($sub_url != '' || count($sub_content) != 0) {
|
|
|
|
|
array_push($keycount, array('key' => $key, 'sub_url' => $sub_url, 'sub_content' => $sub_content));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|