【发布时间】:2020-09-04 20:25:58
【问题描述】:
我需要转换
h 这个 JSON:
["theory",["theory","theory of relativity","theory test","theory of everything","theory definition","theory of evolution","theory of mind","theory of a deadman","theory of love","theory meaning"]]
到一个数组,包括嵌套,在 PHP 中:
array (
0 => 'theory',
1 =>
array (
0 => 'theory',
1 => 'theory of relativity',
2 => 'theory test',
3 => 'theory of everything',
4 => 'theory definition',
5 => 'theory of evolution',
6 => 'theory of mind',
7 => 'theory of a deadman',
8 => 'theory of love',
9 => 'theory meaning',
),
)
在 PHP 中转换为对象后,我需要能够访问/找到对象中的“相对论”。
【问题讨论】:
-
查看 json_decode 的 php 文档 php.net/manual/en/function.json-decode.php
-
这能回答你的问题吗? How to convert JSON string to array
-
到目前为止你尝试过什么?你被困在哪里了?