In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
Php save data to the database how to solve the problem, in view of this problem, this article introduces the corresponding analysis and solutions in detail, hoping to help more partners who want to solve this problem to find a more simple and easy way.
Php save data to the database garbled solutions: 1, add "header (" Content-Type: text/html; charset=utf-8 ") in the php file; 2, set mysql encoding through mysql_query; 3, set HTML file encoding.
This article operating environment: Windows7 system, PHP7.1 version, Dell G3 computer
What if php saves data to the database with garbled codes?
Chinese garbled codes saved by php to mysql database
Recently, there is another php project, garbled code is a headache.
Solution:
1add header ("Content-Type: text/html; charset=utf-8") to the Content-Type php file
2. The php program that needs to do database operations is preceded by mysql_query ("set names' code'"). The code is the same as the php code. If the php code is gb2312, then the mysql code is gb2312, if it is utf-8.
Mysql encoding is utf8, so that there is no garbled code when inserting or retrieving data.
Mysql_query ("set names' utf8'") or mysqli_query ("set names' utf8'")
It should be noted that the red mark is utf8, not utf-8.
3. The html files used should be encoded all the time, usually using utf-8.
This is the answer to how to solve the problem of how to save data to the database by php. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel to learn more about it.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.