有人可以帮我解码这个字符串吗?
[[["¡hola","hello","",""]],[["interjection",
["¡Hola!","¡Caramba!","¡Oiga!","¡Diga!","¡Bueno!","¡Vale!","¡Aló!"],[["¡Hola!",
["Hello!","Hi!","Hey!","Hullo!","Hallo!","Hoy!"],,0.70910621],["¡Caramba!",
["Gee!","Well!","Good gracious!","Well I never!","By jingo!","By gum!"]],["¡Oiga!",
["Listen!","Hello!","Hullo!","Hallo!","I say!","See here!"]],["¡Diga!",
["Hello!","Hullo!","Talk away!"]],["¡Bueno!",["Well!","All
right!","Hello!","Hallo!","Hullo!"]],
["¡Vale!"["Okay!","OK!","O.K.!","Okey!","Hello!"]],
["¡Aló!",["Hello!","Hullo!","Halliard!"]]],"Hello!",9]],"en",,[["¡hola",
[1],true,false,999,0,2,0]],[["hello",1,[["¡hola",999,true,false],
["Hola",0,true,false],["saludar",0,true,false],["saludo",0,true,false]],
[[0,5]],"hello"]],,[,"Hello!",[10],,true],
[],3]
我试过json_decode
但没有运气。
谢谢!
答案 0 :(得分:0)
我自己找到了一个解决方案,将字符串转换为有效的JSON。希望这会对某人有所帮助。
$t = '[[["¡hola","hello","",""]],[["interjection",
["¡Hola!","¡Caramba!","¡Oiga!","¡Diga!","¡Bueno!","¡Vale!","¡Aló!"],[["¡Hola!",
["Hello!","Hi!","Hey!","Hullo!","Hallo!","Hoy!"],,0.70910621],["¡Caramba!",
["Gee!","Well!","Good gracious!","Well I never!","By jingo!","By gum!"]],["¡Oiga!",
["Listen!","Hello!","Hullo!","Hallo!","I say!","See here!"]],["¡Diga!",
["Hello!","Hullo!","Talk away!"]],["¡Bueno!",["Well!","All
right!","Hello!","Hallo!","Hullo!"]],
["¡Vale!"["Okay!","OK!","O.K.!","Okey!","Hello!"]],
["¡Aló!",["Hello!","Hullo!","Halliard!"]]],"Hello!",9]],"en",,[["¡hola",
[1],true,false,999,0,2,0]],[["hello",1,[["¡hola",999,true,false],
["Hola",0,true,false],["saludar",0,true,false],["saludo",0,true,false]],
[[0,5]],"hello"]],,[,"Hello!",[10],,true],
[],3]';
$t = str_replace(',,',',"",',$t);
$t = str_replace('[,','["",',$t);
$t = str_replace(',]',',""]',$t);
$arr = json_decode($t);
print_r($arr);