在我看来,我有这部分:
$rep = array(' ', '@', ',');
$naslov = strtolower(str_replace($rep, '_', $vest['naslov']));
$naslov = str_replace('"', '', $naslov );
$text = html_entity_decode(word_limiter(($vest['opis']),63));
$text = preg_replace("/<img[^>]+>/i", "", $text);
$text = str_replace('\n', '<br>', $text);
这对 3 种不同类型的文章重复了 3 次(这是必需的,没有办法解决这个问题)。我的问题是:在视图中调用自定义库是好还是坏?除了这个和在视图控制器中编写函数之外还有其他方法吗(我在其他几个视图文件中也需要这个函数)?