For string truncation questions, please refer to $ str sales; $ str sales in large quantities; $ str sales basic principles; $ str left dry in; echo & nbsp; substr ($ str, 1 ); why is it garbled? I searched for a few resolutions on the Internet, and found no such issue as www.111cn.netphperphp-cy35494.htm & nbsp. Question about string truncation
$ Str = "sales ";
$ Str = "sales in large ";
$ Str = "basic sales acquisition principles ";
$ Str = "left blank ";
Echo substr ($ str, 1 );
Why is it garbled?
I found some solutions on the Internet http://www.111cn.net/phper/php-cy/35494.htm are not good, or show garbled. How can I solve this problem? my gbk code
Share:
------ Solution --------------------
Mb_internal_encoding ("GBK ");
Echo mb_substr ($ str, 1 );
------ Solution --------------------
$ Str = "basic sales acquisition principles ";
Echo mb_substr ($ str, 1,6, "gb2312 ");