2016-11-25 125 views
0
Array 
(
[0] => Array 
    (
     [lead_id] => 1 
     [employee_id] => 2 
     [update_date] => 2016-11-25 
     [lead_status] => Fresh Leads 
     [reason] => Deal Won 
     [notes] => Array 
      (
       [0] => Array 
        (
         [notes] => Notes 1 
        ) 

       [1] => Array 
        (
         [notes] => Notes 2 
        ) 

       [2] => Array 
        (
         [notes] => Notes 3 
        ) 

      ) 

    ) 

[1] => Array 
    (
     [lead_id] => 1 
     [employee_id] => 5 
     [update_date] => 2016-11-25 
     [lead_status] => Fresh Leads 
     [reason] => Deal Won 
     [notes] => Array 
      (
       [0] => Array 
        (
         [notes] => Notes 1 
        ) 

       [1] => Array 
        (
         [notes] => Notes 2 
        ) 

       [2] => Array 
        (
         [notes] => Notes 3 
        ) 

      ) 

    ) 

[2] => Array 
    (
     [lead_id] => 3 
     [employee_id] => 2 
     [update_date] => 2016-11-25 
     [lead_status] => Fresh Leads 
     [reason] => Deal Won 
     [notes] => Array 
      (
       [0] => Array 
        (
         [notes] => Notes 1 
        ) 

       [1] => Array 
        (
         [notes] => Notes 2 
        ) 

       [2] => Array 
        (
         [notes] => Notes 3 
        ) 

      ) 

    ) 

) 

这是我的json数组。
我怎样才能得到这个数组中的每个字段的值?
请帮助从json数组插入json_decode后在php

+4

这是不使用following url

这个读JSON对象的简单的代码验证您的JSON数组或JSON对象JSON。 – brian

+3

[在json \ _decode/multidimensional数组之后访问JSON数组]可能的副本(http://stackoverflow.com/questions/14934660/accessing-json-array-after-json-decode-multidimensional-array) – rbr94

+2

这是php数组。 'foreach($ arr as $ ar){echo $ ar ['lead_id']; //为其他人}} –

回答

0

这不是有效的JSON数组, 您可以使用PHP

$data = '{ 
    "name": "Saman", 
    "age": "19", 
     "records":[{ 
       "subject1":"Maths", 
       "marks":"67" 

      }] 
     }'; 

$character = json_decode($data); 
echo "Name :".$character->name; 
echo "Age :".$character->age;