Home > Backend Development > PHP Tutorial > How to generate UTF8 files with PHP_PHP tutorial

How to generate UTF8 files with PHP_PHP tutorial

WBOY
Release: 2016-07-21 15:38:19
Original
1123 people have browsed it

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);
?>

www.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...
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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template