相关疑难解决方法(0)

将JSON字符串转换为PHP数组

我有以下JSON字符串,它是一个Objective C数组,然后编码为JSON:

 $jsonString=[\"a@gmail.com\",\"b@gmail.com\",\"c@gmail.com\"]
Run Code Online (Sandbox Code Playgroud)

我想将其转换为常规PHP数组.我尝试了很多东西但是它们似乎都没有用:

$arrayOfEmails=json_decode($jsonString); //doesn't work
$arrayOfEmails=(array)json_decode($jsonString); //doesn't work
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?

编辑:

我还没有上班.

$decodeEmails=$_POST["arrayOfEmails"];
sendResponse(200, $decodeEmails);
//the above returns exactly whats after this colon:[\"a@gmail.com\",\"b@gmail.com\",\"c@gmail.com\]
Run Code Online (Sandbox Code Playgroud)

我需要这样做: $arrayOfEmails=json_decode($decodeEmails); 但我认为我需要在$ decodingEmails周围引用才能使用它.如何在$ decodeEmails字符串周围添加引号?

php json

8
推荐指数
2
解决办法
7万
查看次数

标签 统计

json ×1

php ×1