strtr函数目字符替换出现乱码
Jun 13, 2016 am 11:31 AM
strtr函数字符替换出现乱码
我的替换词库来源于一个文本文件。文本文件无论改成gbk还是utf-8格式都出现乱码。
如果把替换词库自己定义如下:
$words = array('发文说'=>'DDDDDDDDDDDDDDDDDDDd');
替换就不会出现乱码
$data['content'] = strtr($data['content'], $words);
我把words变量打印出来,里面的词组都没有乱码,用函数检测,也不是utf-8格式。所以可以确认,内容和替换词组都是gbk格式的字符串。
请问如何解决这个问题?谢谢

Hot tools Tags

Hot Article

Hot tools Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Solution: Your organization requires you to change your PIN

How to adjust window border settings on Windows 11: Change color and size

How to enable or disable taskbar thumbnail previews on Windows 11

How to change title bar color on Windows 11?

OOBELANGUAGE Error Problems in Windows 11/10 Repair

10 Ways to Adjust Brightness on Windows 11

How to turn off private browsing authentication for iPhone in Safari?
