我有一个看起来像一个数组的字符串: -
'[["hello","world"],["etc","etc..."]]'
有没有办法'反序列化'即使它不是真正适当的序列化格式.
您可以将其作为数组返回,因为它是JSON:
$json = '[["hello","world"],["etc","etc..."]]'; $decoded = json_decode($json, true); // true option returns associative array print_r($decoded);
收益:
Array ( [0] => Array ( [0] => hello [1] => world ) [1] => Array ( [0] => etc [1] => etc... ) )