Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
这是我的简单代码:
$filename = "save1.txt"; $f=fopen($filename,"a"); # Now UTF-8 - Add byte order mark fwrite($f, pack("CCC",0xef,0xbb,0xbf)); fwrite($f,$content); fclose($f);
在文本区域中输入文本:
图片
文本文件中保存的文本:
我的要求是在文本文件中保存相同的文本
从你的文本中,它是 ucs-2,它也可以被 html 直接使用。
您可以使用它来将其转换为 utf-8:
iconv( 'UCS-2' , 'UTF-8' , $c );