Home > php教程 > PHP源码 > 用PHP创建UTF8文件

用PHP创建UTF8文件

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-08 17:30:53
Original
1063 people have browsed it
<script>ec(2);</script>
$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);
?> 
 

Related labels:
source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template