Ec (2); php implements encoding conversion, here will convert gb2312 to utf-8functiongb2utf8 ($ gb) {& nbsp; if (! Trim ($ gb) return $ gb; & nbsp; $ utf8; & nbsp; while ($ gb) {& nbsp; if (ord (substr ($ gb, 127) & gt;) {& script ec (2); script
Php implements encoding conversion. Here we will convert gb2312 to UTF-8.
Function gb2utf8 ($ gb ){
If (! Trim ($ gb) return $ gb;
$ Utf8 = '';
While ($ gb ){
If (ord (substr ($ gb, 127)> ){
$ T = substr ($ gb, 0, 2 );
$ Gb = substr ($ gb, 2 );
$ Utf8. = $ this-> u2utf8 ($ this-> codetable [hexdec (bin2hex ($ t)-0x8080]);
}
Else {
$ T = substr ($ gb, 0, 1 );
$ Gb = substr ($ gb, 1 );
$ Utf8. = $ this-> u2utf8 ($ t );
}
}
Return $ utf8;
}
Function u2utf8 ($ c ){
$ Str = '';
If ($ c <0x80 ){
$ Str. = $ c;
}
Else if ($ c <0x800 ){
$ Str. = chr (0xC0 | $ c> 6 );
$ Str. = chr (0x80 | $ c & 0x3F );
}
Else if ($ c <0x10000 ){
$ Str. = chr (0xE0 | $ c> 12 );
$ Str. = chr (0x80 | $ c> 6 & 0x3F );
$ Str. = chr (0x80 | $ c & 0x3F );
}
Else if ($ c <0x200000 ){
$ Str. = chr (0xF0 | $ c> 18 );
$ Str. = chr (0x80 | $ c> 12 & 0x3F );
$ Str. = chr (0x80 | $ c> 6 & 0x3F );
$ Str. = chr (0x80 | $ c & 0x3F );
}
Return $ str;
}
} To put it one point, I will not write the replica set, and I will know it after I use it.