首先把内容编码,再追加\xEF\xBB\xBF
$fp=fopen("text.txt", "w+"); $text = iconv('gb2312', 'utf-8', "中国");// adding header $text="\xEF\xBB\xBF".$text; fputs($fp, $text); fclose($f);
博客园 © 2004-2025 浙公网安备 33010602011771号 浙ICP备2021040463号-3