在PHP中,请问怎样才能方便地读取下面这种类型数据中的值呢?[[["123", "abc"],["def","fghasdf"],123,0,1,2],["","asdf"],,,123]先谢谢了!

解决方案 »

  1. cvm
  2. 数据源就是上面这种字符串来的,想要在php中读取出里面的特定的值,比如里面的“abc”等
      

  3. $s = '[[["123", "abc"],["def","fghasdf"],123,0,1,2],["","asdf"],123]';
    print_r(json_decode($s));
    Array
    (
        [0] => Array
            (
                [0] => Array
                    (
                        [0] => 123
                        [1] => abc
                    )            [1] => Array
                    (
                        [0] => def
                        [1] => fghasdf
                    )            [2] => 123
                [3] => 0
                [4] => 1
                [5] => 2
            )    [1] => Array
            (
                [0] => 
                [1] => asdf
            )    [2] => 123
    )