Php substr intercepts Chinese characters, leading to garbled characters. Due to Encoding Problems, each Chinese Character occupies three characters. Therefore, when intercepting, You need to determine and intercept the characters to avoid garbled characters. UTF intercepts the Chinese functionutf_substr ($ str, $ len) {for ($ i0; $ I $ len; $ I ++) {$ temp_strsubstr ($ str ); if (ord ($ temp
Php substr intercepts Chinese characters, leading to garbled characters. Due to Encoding Problems, each Chinese Character occupies three characters. Therefore, when intercepting, You need to determine and intercept the characters to avoid garbled characters. // UTF intercepts the Chinese function utf_substr ($ str, $ len) {for ($ I = 0; $ I $ len; $ I ++) {$ temp_str = substr ($ str, 0, 1); if (ord ($ temp
Php substr intercepts Chinese characters, leading to garbled characters. Due to Encoding Problems, each Chinese Character occupies three characters. Therefore, when intercepting, You need to determine and intercept the characters to avoid garbled characters.
// UTF intercepts the Chinese function utf_substr ($ str, $ len) {for ($ I = 0; $ I <$ len; $ I ++) {$ temp_str = substr ($ str, 127); if (ord ($ temp_str)>) {$ I ++; if ($ I <$ len) {$ new_str [] = substr ($ str,); $ str = substr ($ str, 3) ;}} else {$ new_str [] = substr ($ str, 0, 1); $ str = substr ($ str, 1) ;}return join ($ new_str );}