Copy code The code is as follows:
$f=fopen("test.txt", "wb" );
$text=utf8_encode("a!");
//First use the function utf8_encode to convert the data to be written into UTF encoding format.
$text="\xEF\xBB\xBF".$text;
//"\xEF\xBB\xBF", this string of characters is indispensable, the generated file will be in UTF-8 format, otherwise it will still be It is ANSI format.
fputs($f, $text);
//Write.
fclose($f);
?>
http://www.bkjia.com/PHPjc/321760.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/321760.htmlTechArticleCopy the code as follows: ?php $f=fopen("test.txt", "wb"); $ text=utf8_encode("a!"); //First use the function utf8_encode to convert the data to be written into UTF encoding format. $text="\xEF\xBB\xB...