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

What should I do if php prints out garbled codes

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

Share

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

Php print garbled code how to do, I believe that many inexperienced people do not know what to do, so this article summarizes the causes of the problem and solutions, through this article I hope you can solve this problem.

Php print out garbled solutions: 1, open the corresponding PHP code file; 2, add "header (" content-type:text/html; charset=utf-8 ");" in the code.

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

What if php prints out garbled codes?

Php print Chinese garbled code

The text format of php documents is set to utf-8 format

Add to the code

Header ("content-type:text/html; charset=utf-8")

Header-send native HTTP headers

Description

Header (string $string, bool $replace = true, int $response_code =?): void

Header () is used to send native HTTP headers.

Note that header () must be called before any actual output, whether it's a normal HTML tag, or a blank line of file or PHP output, whitespace. This is a common error when accessing functions in other files through include,require, if there are spaces or blank lines in it before header () is called. The same problem exists in a separate PHP/HTML file.

After reading the above, have you mastered the method of how to print out garbled codes by php? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

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