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/02 Report--
This article mainly introduces how to solve the php byte loss garbled problem, the article is very detailed, has a certain reference value, interested friends must read it!
Solutions to missing garbled php bytes: 1, using "mb_substr ($str, 0,1, 'gbk');" method to intercept Chinese strings; 2, using "mb_substr ($str, 0,2,' utf-8');" to intercept Chinese strings.
This article operating environment: Windows7 system, PHP7.4 version, Dell G3 computer.
Php removes garbled characters from strings due to byte loss
Using php built-in method mb_substr to intercept non-garbled codes
1. Example of GBK coding interception:
$str = 'who am I'; / gbk encoded string echo mb_substr ($str, 0,1, 'gbk'); / / output me
The mb_substr method has one more parameter than substr and is used to specify string encoding.
2. Example of utf-8 coding interception:
$str = 'who am I abc'; / / utf-8-encoded string echo mb_substr ($str, 0, 2, 'utf-8'); / / output me a
There is no problem with the mixture of China and Britain.
The above is all the contents of the article "how to solve the problem of missing garbled bytes in php". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
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.