How does php generate a UTF-8 html file? How does php generate a UTF-8 html file ?? Note that not simply adding & lt; metahttp-equiv = & quot; Content-Type & quot; content = & quot; text/html; charset = ut php to generate UTF-8 html files
How does php generate UTF-8 html files ?? Note that not simply adding , But after the file is generated, use notepad to open and save the file, and the encoding is UTF-8 automatically.
------ Solution --------------------
PHP itself is unencoded, and all strings are generally considered as binary streams. Therefore, you only need to enter a string for the Utf-8. If the string adopts other encoding, you can use the iconv series function to convert the encoding.
------ Solution --------------------
Fwrite ($ f, "\ xEF \ xBB \ xBF". iconv ('gbk', 'utf-8', $ html ));
------ Solution --------------------
UTF-8, which is added to the html file Soon, I will give you a class that generates static html.
/****************** 8PHP static class *************/
Class Shtml
{
Var $ Templet;
Var $ DataSource;
Var $ Dir;
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.