Home  >  Article  >  Backend Development  >  How to solve the php var_dump garbled problem

How to solve the php var_dump garbled problem

藏色散人
藏色散人Original
2021-03-26 10:39:322879browse

php var_dump garbled solution: 1. Open the chrome browser, select "Options-More Tools-Encoding", and then select utf-8 or unicode; 2. Add a statement before using var_dump in the code "Header("...charset=utf-8)" is enough.

How to solve the php var_dump garbled problem

The operating environment of this article: windows7 system, Chrome76.0&&php7.1 version, DELL G3 computer

php language var_dump will appear garbled characters when printing Chinese

php language var_dump will appear garbled characters when printing Chinese. There are two solutions: 1. Print the output to For common browsers such as Firefox and Chrome, you can change the encoding method of the browser. Take the Chrome browser as an example. Options-More Tools-Encoding, select utf

php language var_dump will cause garbled characters when printing Chinese. There are two solutions:

1. When printing to common browsers such as Firefox and Chrome, just change the browser's encoding method

Take the Chrome browser as an example, option - More tools - encoding, select utf-8 or unicode:

How to solve the php var_dump garbled problem

2. If the output is to an unusual browser (such as some IDEs automatically The built-in browser that comes with it) does not have the function of changing the encoding

Just add a sentence before using var_dump() in the code:

Header("Content-Type:text/html;charset=utf-8");

.

[Recommended learning :PHP video tutorial

The above is the detailed content of How to solve the php var_dump garbled problem. For more information, please follow other related articles on the PHP Chinese website!

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