Unicode解码PHP返回不起作用

时间:2016-07-10 09:54:15

标签: php unicode

我在PHP中遇到一个问题:

// Russian Language  ( in english it works)
$string = "Гиорги"   ;  
echo $un;  // result is Гиорги
return  $un; // Result is \u0413\u0438\u043e\u0440\u0433\u0438

我需要返回也在RETURN中解码,我是怎么做到的?我试过了:

return json_decode('"'.$un.'"');

没有作品

我正在返回Array:

// here  $un  is "Гиорги";
    $img = 'resimg.php?r='. $Test['id'] .'&u='. $u .'&f='. $f.'&fn='. $fn.'&un='. $un ;
// I am only showing you $img so leave others I didnt pasted like $sd or so. so just leave it target $img only
         return array(
                          'status' => true,
                          'img' => $img, // this is 
                          'code' => str_replace('+', '@', $this->enCode($sd)),
                          'fname' => $Test['descripcion'],
                          'ResIF' => $Test['id']                  
                        );
                    } 

之后我在控制台中得到了这个结果:

"status":true,"img":"resimg.php?r=248&u=295706407437389&f=295706407437389&fn=\u0413\u0438\u043e\u0440\u0433\u0438&un=\u0413\u0438\u043e\u0440\u0433\u0438","code":"4trQytfe4KOL197g0tjMp93R26TrqpufnZ\/ipp2erqSZoZmppJ2enKylopHLtp@ioJypo52bnK2goJ6dspPP2aJJADkjNTc@6TsYSSWP4NO2Pfw7HUkrOus1LD0hl4Xgp6GckZnhzt7Zs6Wal4Xu28rYyrM9\/DsdSSs66zUsPSGXhd\/bytjKsz38Ox1JKzrrNSw9IZeF69LctKmzn52j","fname":"ststst","ResIF":"248"}

因此,如果我回显,它会在控制台中显示正确的名称,但如果返回则显示已编码。

0 个答案:

没有答案