新手转码问题 $url='test.txt'; $read = fopen($url,'r') or die('打开失败'); $text=fread($read,100); fclose($read); echo iconv('UTF-8','GBK','这是一个测试').'';#这句OK echo iconv('UTF-8','GBK',$text).'';#这句报错 로그인 후 복사 以上第一个echo正常,第二个echo就老是报以下错误: Notice: iconv(): Detected an illegal character in input string test.txt文件为UTF-8格式。 分享到: 更多 ------解决方案--------------------echo iconv('UTF-8','GBK//IGNORE',$text) //IGNORE能忽略掉它不认识的字接着往下转不报错,//TRANSLIT是截掉它不认识的字及其后面的内容,报错