In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the relevant knowledge of "how php changes data coding from utf-8 to gbk". The editor shows you the operation process through an actual case. The method of operation is simple, fast and practical. I hope this article "how to encode data from utf-8 to gbk" can help you solve the problem.
In php, you can use the iconv () function to change the encoding of the data from utf-8 to gbk, which converts the string to the required character encoding, the syntax "iconv (" UTF-8 "," gbk//TRANSLIT ", $str)".
Operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer
In php, you can use the iconv () function to change the encoding of data from utf-8 to gbk.
The iconv () function can also convert encoded gbk to utf8.
Description: iconv () function
The iconv () function converts a string to the required character encoding.
Syntax:
Iconv (string $in_charset, string $out_charset, string $str): string
Converts the string str from in_charset to out_charset.
Parameter description:
$in_charset: the character set entered.
Out_charset: the character set of the output.
If you add the string / / TRANSLIT after out_charset, the transliteration function will be enabled. This means that when a character cannot be represented by the target character set, it can be expressed approximately by one or more similar characters. If you add the string / / IGNORE, characters that cannot be expressed in the target character set will be silently discarded. Otherwise, it will result in an E_NOTICE and return false.
Warning
/ / the details of TRANSLIT operation are highly dependent on the system's iconv () implementation (see ICONV_IMPL). It is reported that the implementation on some systems will directly ignore / / TRANSLIT, so the conversion may also fail, and the out_charset will be substandard.
Str: the string to be converted.
Return value: returns the converted string or false on failure.
Since version 5.4.0, false will be returned if the character is illegal, unless / / IGNORE is specified in the output character. In previous versions, it returned a portion of the string.
This is the end of the introduction to "how php transforms data encoding from utf-8 to gbk". Thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.
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.