如何通过PHP
问题描述:
我使用Facebook的API解码 '\ u0040' 到 '@',但Json的返回:如何通过PHP
{
"id": "674271626114503",
"email": "duc2521997\u0040gmail.com"
}
如何通过PHP解码 '\ u0040' 到 '@'? 谢谢。
答
试试这个,在这里我们使用json_decode
将自己照顾\u0040
到@
<?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"];
+0
它工作!谢谢 –
+0
@ĐứcNguyễn欢迎朋友.... :) –
+0
'utf8_decode()'是不必要的。它没有工作很愉快。见https://eval.in/794819 – RiggsFolly
只有采取简单的选项是不被接受的回答并使用'json_decode()' – RiggsFolly