Home  >  Article  >  Backend Development  >  php截取中文乱码有关问题

php截取中文乱码有关问题

WBOY
WBOYOriginal
2016-06-13 11:01:11810browse

php截取中文乱码问题

在页面显示链接地址的时候,要控制字数,字母还没问题,当遇到中文的时候,截取容易出现乱码,以前在smarty中有caterutf8()这个函数,在php中有很多函数来截取字符sub_str(),mb_substr()很多,mb_strcut($arrList['Video']['video_title'],0,30,'utf8')这个函数可以截取字符串,后面的参数可以设置编码,不过用这个函数的时候要php打开mb_string模块。

?

mysql()中的一个函数find_in_set('aa',column);可以用来查询column中包含'aa'的记录,比like更加准确,它可以把'aa'当做一个原子来进行查询,多用在一个字符串中存有多个信息时候。

?

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn