mar*_*tin 0 php deserialization
我有一个看起来像一个数组的字符串: -
'[["hello","world"],["etc","etc..."]]'
Run Code Online (Sandbox Code Playgroud)
有没有办法'反序列化'即使它不是真正适当的序列化格式.
您可以将其作为数组返回,因为它是JSON:
$json = '[["hello","world"],["etc","etc..."]]';
$decoded = json_decode($json, true); // true option returns associative array
print_r($decoded);
Run Code Online (Sandbox Code Playgroud)
收益:
Array
(
[0] => Array
(
[0] => hello
[1] => world
)
[1] => Array
(
[0] => etc
[1] => etc...
)
)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
36 次 |
| 最近记录: |