Home >Backend Development >PHP Problem >How to set default encoding in php

How to set default encoding in php

醉折花枝作酒筹
醉折花枝作酒筹Original
2021-04-14 10:14:283583browse

How to set the default encoding in php: 1. Find the "php.ini" configuration file in the php installation path and open it; 2. Find the "default_charset" item in the file and set the value of this item to The encoding format we need (such as "utf-8").

How to set default encoding in php

The operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer.

The PHP suite is easy to install, has complete versions and functions, and is optimized in place. It is very suitable for server use and is deeply loved by the majority of users. For the PHP encoding in the suite, we considered the actual situation of the vast majority of users and adopted GBK encoding by default, so there is no problem for most programs. However, some programs require UTF-8 encoding, otherwise garbled characters will appear. Therefore, you need to manually set the default encoding of PHP. Please see the following:

The first step is to find the installation of PHP. Path, find the php.ini file and open it.

How to set default encoding in php

## The second step is to find default_charset = 'GBK', set it to default_charset = 'UTF-8', and save it. As follows:

How to set default encoding in php

The third step is to restart IIS and reopen the website to take effect.

Recommended learning:

php video tutorial

The above is the detailed content of How to set default encoding in php. 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