This is actually correct. It looks like it is indeed converting utf-8 to gb2312, but in actual operation, it often ends in failure. What is the reason? The reason is very simple, because any function will have an execution error, and unfortunately iconv(); will eventually have an error. Correct approach:
Just add a //ignore after it, add this The iconv() function can ignore the error and continue execution. Similarly, if you want to change gb2312 to utf-8, just write $content = iconv("gb2312","utf-8//ignore",$content); |