Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problem of not displaying Chinese characters in php

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains how to solve the problem that Chinese characters are not displayed in php. Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn "php contains Chinese characters do not display how to solve" it!

Solution: 1, use "header (" Content-type:text/html;charset:utf-8 ")" to set the encoding format of the page to "utf-8"; 2, modify the content of "default_charset" in the "php.ini" file to "UTF-8".

This article operating environment: Windows10 system, PHP7.1 version, Dell G3 computer.

How to solve the problem of not displaying Chinese characters in php

1. Create a new php file, named test.php, and use the header () method to set the encoding format of the page to utf-8.

Examples are as follows:

2. Find the php.ini file, usually under the php directory file. Open the file, hold down ctrl+F to find the configuration item that needs to be modified, and then remove the previous comments, usually semicolons (that is,;). Then modify the desired value, and then save the file. Restart PHP and the server apache or nginx.

Open the php.ini file and find it; default_charset = "iso-8859-1", change to: default_charset = "UTF-8" remove the previous semicolon (remove comments), change the character set to UTF-8, restart the apache service, refresh the page, and the Chinese display is normal.

At this point, I believe you have a deeper understanding of "php contains Chinese characters do not show how to solve", might as well come to the actual operation of it! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report