在controller直接echo的时候,某些浏览器会出现乱码的情况。可以用下面两种方法解决:
1、常用的php的header函数
header("Content-type:text/html;charset=utf-8");
示例:
CodeIgniter的Text Helper有一个ellipsize()方法,用来过滤HTML标签并且截断文字十分好用。但是它对中文支持的特别不好,在中文中使用就有乱码出现。
下面有网友将function ellipsize()进行了修改,使得它支持中文:
在CI 2.1.3版本中,修改ci_2.1.3\system\helpers\text_helper.php 文件