是的,PHP的fputs()
函数支持UTF-8编码
<?php $file = fopen("example.txt", "w"); $string = "这是一个UTF-8字符串: 你好,世界!"; fwrite($file, $string); fclose($file); ?>
在这个示例中,我们使用fopen()
函数以写入模式(“w”)打开一个名为example.txt
的文件。然后,我们使用fwrite()
函数将UTF-8编码的字符串写入文件。最后,我们使用fclose()
函数关闭文件。