PHP生成UTF8文件的方法_PHP
- WBOYOriginal
- 2016-06-01 12:18:16815browse
复制代码 代码如下:
$f=fopen("test.txt", "wb");
$text=utf8_encode("a!");
//先用函数utf8_encode将所需写入的数据变成UTF编码格式。
$text="\\xEF\\xBB\\xBF".$text;
//"\\xEF\\xBB\\xBF",这串字符不可缺少,生成的文件将成为UTF-8格式,否则依然是ANSI格式。
fputs($f, $text);
//写入。
fclose($f);
?>
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn