How to set the encoding of mysql to utf-8 in php

藏色散人
Release: 2023-03-05 19:26:01
Original
3794 people have browsed it

php method to set the encoding of mysql to utf-8: first use the editor to open the my.ini configuration file; then add the configuration [character-set-server=utf8]. You can also set the encoding when connecting to the database through the mysqli_set_charset() function.

How to set the encoding of mysql to utf-8 in php

Recommendation: "php video tutorial"

Both methods can be used:

1. In the my.ini file, be sure to restart after setting up


2. When connecting to the database, the code here must be in the database Before writing the query, you must pass in the connection object and encoding



Finally, you can read it in the browser Chinese


The above is the detailed content of How to set the encoding of mysql to utf-8 in php. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template