【发布时间】:2012-04-11 14:36:17
【问题描述】:
使用数据库显示带有 html 字符的文章:
$row->文章:
<div class="article">
As is usual also in Buenos Aires, is held in that city again the official Asterisk Advanced course with the new agenda <a href="http://www.google.com">google page</a>
</div>
使用:character_limiter($row->article, 160) 短文本,但碰巧剪掉了超链接,导致html代码出错,我用函数strip_tags()解决...但它显示以下:
<div class="article">
As is usual also in Buenos Aires, is held in that city again the official Asterisk Advanced course with the new agendagoogle page...
</div>
如您所见,该函数删除了超链接标签,但也删除了周围的空格。
我已经阅读了这篇文章:Problem using strip_tags in php
...但使用设置为 2 个文本元素的正则表达式。我想知道您是否可以使用类似但带有未定义标签的东西。我希望你的帮助
【问题讨论】:
标签: codeigniter strip-tags character-limit