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

How to solve the problem of interactive garbled code between php and database

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

Share

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

This article will explain in detail how to solve the problem of interactive garbled between php and database. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.

The solution to the interactive garbled code between php and database: 1. Change the mysql character coding to utf8_general_ci;2, and set the character coding in the PHP file.

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

1. Garbled code occurs when PHP writes to the database.

As shown in the picture, put the proofreading over to see if it is any other language.

Click modify to change the character encoding to utf8_general_ci

2. Garbled code occurs when PHP reads the database to the page.

As shown in the following figure

It is not enough to set the character encoding in the PHP file.

Select the character set when creating a connection to the database, so that it will be formatted as UTF8 when it is taken out of the database.

Normal display

This is the end of this article on "how to solve the problem of interactive garbled code between php and database". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it out for more people to see.

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