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

How to generate UTF8 files with PHP_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:38:191079browse

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...
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