PHP converts Unicode encoding to Chinese characters. the webpage displays Chinese characters, but the source code shows the following unicode encoding: PHPcode & amp; #12304; GNIOUS & amp; #12305; & amp; #30701; & amp; #34966; & amp; #24773; & amp; #20387; how can PHP convert Unicode encoding to Chinese characters?
The webpage displays Chinese characters, but the source code is the unicode code below.
PHP code
[GNIOUS] short-sleeved couples T-shirt Grand City love 4-time stamp-rose ----- click on the circle on the picture, directly buy this baby -------
How does PHP convert this code into Chinese characters? Because you need to call these Chinese characters for search strings
------ Solution --------------------
$ S = <CODE
GNIOUS
CODE;
Function foo ($ v ){
Return iconv ('ucs-2', 'gbk', pack ('N', $ v [1]);
}
Echo preg_replace_callback ('/& # (\ d +);/', 'foo', $ s );
GNIOUS