Home > Backend Development > PHP Problem > What should I do if php cannot write Chinese?

What should I do if php cannot write Chinese?

藏色散人
Release: 2023-03-15 06:50:01
Original
2982 people have browsed it

Solution to why php cannot write Chinese: 1. Set the encoding of html page and php page to "charset=utf-8"; 2. Change the client through "mysql_query("set names utf8");" end encoding.

What should I do if php cannot write Chinese?

The operating environment of this article: Windows 7 system, PHP version 7.1, DELL G3 computer

What should I do if php cannot write Chinese?

1. The garbled code problem in the html page itself

The solution is to use the pure html page

<meta http-equiv="Content-type=text/html;charset=utf-8"/>
Copy after login

2. The garbled code problem in the php page itself

header("Content-type=text/html;charset=utf-8");
Copy after login

3. Change the client's encoding.

mysql_query("set names utf8"); // 写到我们获取数据之前即可。
Copy after login

Recommended learning: "PHP Video TutorialCourse"

The above is the detailed content of What should I do if php cannot write Chinese?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
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