Home >Backend Development >PHP Problem >How to set default encoding in php
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").
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.
## The second step is to find default_charset = 'GBK', set it to default_charset = 'UTF-8', and save it. As follows:
The third step is to restart IIS and reopen the website to take effect.
Recommended learning: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!