2012-06-29 89 views
0
array(1) { 
      [0] => object(stdClass)#53 (14) 
       { 
        ["cart_item_id"]=> string(2) "64" 
        ["cart_id"]=> string(1) "1" 
        ["nid"]=> string(3) "204" 
        ["qty"]=> string(1) "1" 
        "changed"]=> string(10) "1340948878" 
        ["data"]=> array(3) 
         { 
          ["shippable"]=> string(1) "1" 
          ["restrict_qty"]=> string(1) "0" 
          ["module"]=> string(10) "uc_product" 
         } 
        ["title"]=> string(5) "songs" 
        ["vid"]=> string(3) "204" 
        ["cost"]=> string(9) "123.00000" 
        ["price"]=> string(9) "123.00000" 
        ["weight"]=> string(1) "0" 
        ["weight_units"]=> string(2) "lb" 
        ["module"]=> string(10) "uc_product" 
        ["model"]=> string(1) "1" 
       } 
     } 

請幫助如何獲取新變量中只有nid值。我需要從陣列中獲得NID

+1

不可讀....... – 2012-06-29 06:09:42

+3

'$ newVar = $ ARR [0] - > nid;' –

+0

謝謝,我一直在嘗試,但那不工作我只是複製你的代碼並粘貼它的作品....謝謝 – Gajanan

回答

1

經由

$output = $array[0]->nid 

訪問對象得到由->
訪問陣列通過[index]