if ($value && is_string($value)) {
$query = $this->ci->db->query('select id,title,url from '.$this->ci->db->dbprefix(SITE_ID.'_'.$module).' where id IN ('.$value.') order by instr("'.$value.'", id)')->result_array();
foreach ($query as $t) {
$id = $t['id'];
$value = '<a href="'.$t['url'].'" target="_blank">'.$t['title'].'</a>';
$str.= str_replace(array('{id}', '{value}'), array($id, $value), $tpl);
}
}
改成
if ($value && is_string($value)) {
$ids = explode(',', $value);
foreach ($ids as $id) {
$t = $this->ci->db->query('select id,title,url from '.$this->ci->db->dbprefix(SITE_ID.'_'.$module).' where id ='.$id.'')->row_array();
$value = '<a href="'.$t['url'].'" target="_blank">'.$t['title'].'</a>';
$str.= str_replace(array('{id}', '{value}'), array($id, $value), $tpl);
}
}