如何通过 PHP 将 '\u0040' 解码为 '@'

How to decode '\u0040' to '@' by PHP

我使用 Facebook API 但 Json 返回:

{
   "id": "674271626114503",
   "email": "duc2521997\u0040gmail.com"
}

如何通过PHP将'\u0040'解码为'@'? 谢谢

试试这个,这里我们使用 json_decode 本身会处理 \u0040@

Try this code snippet here

<?php
ini_set('display_errors', 1);
$string='{
   "id": "674271626114503",
   "email": "duc2521997\u0040gmail.com"
}';
$array=  json_decode($string,true); //this itself will take care of `\u0040`
echo $array["email"];

输出: duc2521997@gmail.com