2016-11-18 97 views
-6

陣列 ( [類別] =>數組 ( [0] =>數組 ( [ID] => 15 [父] => 11 [名] =>相冊 [蛞蝓] =>相冊 [img_url] =>http://playcontest.in/diy/wordpress/wp-content/uploads/2013/06/cd_5_angle.jpg [數] => 4 [鏈接] =>http://playcontest.in/diy/wordpress/product-category/music/albums/顯示來自複雜的JSON數據的數據在PHP

 [1] => Array 
      (
       [id] => 9 
       [parent] => 0 
       [name] => Clothing 
       [slug] => clothing 
       [img_url] => http://playcontest.in/diy/wordpress/wp-content/uploads/2013/06/hoodie_6_front.jpg 
       [count] => 12 
       [link] => http://playcontest.in/diy/wordpress/product-category/clothing/ 
      ) 

     [2] => Array 
      (
       [id] => 10 
       [parent] => 9 
       [name] => Hoodies 
       [slug] => hoodies 
       [img_url] => http://playcontest.in/diy/wordpress/wp-content/uploads/2013/06/hoodie_6_front.jpg 
       [count] => 6 
       [link] => http://playcontest.in/diy/wordpress/product-category/clothing/hoodies/ 
      ) 



    ) 

[meta_data] => Array 
    (
     [tz] => Europe/London 
     [c] => INR 
     [c_f] => ? 
     [t_i] => 
     [w_u] => lbs 
     [d_u] => in 
     [d_s] => . 
     [t_s] => , 
     [p_d] => 2 
     [c_p] => left 
     [cart_url] => http://playcontest.in/diy/wordpress/cart/ 
     [checkout_url] => http://playcontest.in/diy/wordpress/checkout/ 
     [hide_out_of_stock] => no 
    ) 

[best_selling] => Array 
    (
     [0] => Array 
      (
       [stock] => 1 
       [url] => http://playcontest.in/diy/wordpress/product/woo-album-4/ 
       [desc] => Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. 
       [title] => Woo Album #4 
       [id] => 96 
       [img] => http://playcontest.in/diy/wordpress/wp-content/uploads/2013/06/cd_5_angle.jpg 
       [type] => simple 
       [price] => 9 
       [regular_price] => 9 
       [sale_price] => 
       [category_ids] => Array 
        (
         [0] => 15 
         [1] => 11 
        ) 

       [created_at] => 2013-06-07 11:37:23 
       [average_rating] => 5.00 
       [total_sales] => 23 
       [featured] => 
      ) 

     [1] => Array 
      (
       [stock] => 1 
       [url] => http://playcontest.in/diy/wordpress/product/woo-single-2/ 
       [desc] => Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. 
       [title] => Woo Single #2 
       [id] => 99 
       [img] => http://playcontest.in/diy/wordpress/wp-content/uploads/2013/06/cd_6_angle.jpg 
       [type] => simple 
       [price] => 2 
       [regular_price] => 3 
       [sale_price] => 2 
       [category_ids] => Array 
        (
         [0] => 11 
         [1] => 13 
        ) 

       [created_at] => 2013-06-07 11:38:12 
       [average_rating] => 4.50 
       [total_sales] => 6 
       [featured] => 
      ) 



    ) 

[new_arrivals] => Array 
    (
     [0] => Array 
      (
       [stock] => 1 
       [url] => http://playcontest.in/diy/wordpress/product/woo-single-2/ 
       [desc] => Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. 
       [title] => Woo Single #2 
       [id] => 99 
       [img] => http://playcontest.in/diy/wordpress/wp-content/uploads/2013/06/cd_6_angle.jpg 
       [type] => simple 
       [price] => 2 
       [regular_price] => 3 
       [sale_price] => 2 
       [category_ids] => Array 
        (
         [0] => 11 
         [1] => 13 
        ) 

       [created_at] => 2013-06-07 11:38:12 
       [average_rating] => 4.50 
       [total_sales] => 6 
       [featured] => 
      ) 

     [1] => Array 
      (
       [stock] => 1 
       [url] => http://playcontest.in/diy/wordpress/product/woo-album-4/ 
       [desc] => Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. 
       [title] => Woo Album #4 
       [id] => 96 
       [img] => http://playcontest.in/diy/wordpress/wp-content/uploads/2013/06/cd_5_angle.jpg 
       [type] => simple 
       [price] => 9 
       [regular_price] => 9 
       [sale_price] => 
       [category_ids] => Array 
        (
         [0] => 15 
         [1] => 11 
        ) 

       [created_at] => 2013-06-07 11:37:23 
       [average_rating] => 5.00 
       [total_sales] => 23 
       [featured] => 
      ) 

     [2] => Array 
      (
       [stock] => 1 
       [url] => http://playcontest.in/diy/wordpress/product/woo-single-1/ 
       [desc] => Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. 
       [title] => Woo Single #1 
       [id] => 93 
       [img] => http://playcontest.in/diy/wordpress/wp-content/uploads/2013/06/cd_4_angle.jpg 
       [type] => simple 
       [price] => 0.01 
       [regular_price] => 0.01 
       [sale_price] => 
       [category_ids] => Array 
        (
         [0] => 11 
         [1] => 13 
        ) 

       [created_at] => 2013-06-07 11:36:34 
       [average_rating] => 0.00 
       [total_sales] => 3 
       [featured] => 
      ) 



    ) 

[new_sales] => Array 
    (
     [0] => Array 
      (
       [stock] => 1 
       [url] => http://playcontest.in/diy/wordpress/product/flying-ninja/ 
       [desc] => Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. 
       [title] => Flying Ninja 
       [id] => 70 
       [img] => http://playcontest.in/diy/wordpress/wp-content/uploads/2013/06/poster_2_up.jpg 
       [type] => simple 
       [price] => 12 
       [regular_price] => 15 
       [sale_price] => 12 
       [category_ids] => Array 
        (
         [0] => 12 
        ) 

       [created_at] => 2013-06-07 11:25:01 
       [average_rating] => 4.00 
       [total_sales] => 3 
       [featured] => 
      ) 

     [1] => Array 
      (
       [stock] => 1 
       [url] => http://playcontest.in/diy/wordpress/product/premium-quality-2/ 
       [desc] => Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. 
       [title] => Premium Quality 
       [id] => 73 
       [img] => http://playcontest.in/diy/wordpress/wp-content/uploads/2013/06/poster_3_up.jpg 
       [type] => simple 
       [price] => 12 
       [regular_price] => 15 
       [sale_price] => 12 
       [category_ids] => Array 
        (
         [0] => 12 
        ) 

       [created_at] => 2013-06-07 11:27:38 
       [average_rating] => 2.00 
       [total_sales] => 1 
       [featured] => 
      ) 

     [2] => Array 
      (
       [stock] => 1 
       [url] => http://playcontest.in/diy/wordpress/product/ship-your-idea-2/ 
       [desc] => Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. 
       [title] => Ship Your Idea 
       [id] => 40 
       [img] => http://playcontest.in/diy/wordpress/wp-content/uploads/2013/06/hoodie_7_front.jpg 
       [type] => variable 
       [price] => 30 
       [regular_price] => 
       [sale_price] => 
       [category_ids] => Array 
        (
         [0] => 9 
         [1] => 10 
        ) 

       [min_var_price] => 30 
       [max_var_price] => 35 
       [created_at] => 2013-06-07 11:00:28 
       [average_rating] => 4.00 
       [total_sales] => 0 
       [featured] => 
      ) 



    ) 

[payment] => Array 
    (
     [gateways] => Array 
      (
       [0] => Array 
        (
         [id] => cheque 
         [title] => Cheque Payment 
         [description] => Please send your cheque to Store Name, Store Street, Store Town, Store State/County, Store Postcode. 
         [icon] => 
         [chosen] => 
         [order_button_text] => 
         [enabled] => yes 
         [testmode] => 
         [instructions] => Please send your cheque to Store Name, Store Street, Store Town, Store State/County, Store Postcode. 
         [account_details] => Array 
          (
          ) 

         [settings] => Array 
          (
          ) 

        ) 

       [1] => Array 
        (
         [id] => cod 
         [title] => Cash on Delivery 
         [description] => Pay with cash upon delivery. 
         [icon] => 
         [chosen] => 
         [order_button_text] => 
         [enabled] => yes 
         [testmode] => 
         [instructions] => Pay with cash upon delivery. 
         [account_details] => Array 
          (
          ) 

         [settings] => Array 
          (
           [extra_charges] => 100 
           [extra_charges_msg] => COD Charges 
           [extra_charges_type] => amount 
           [cod_pincodes] => 12345,23456 
           [in_ex_pincode] => include 
          ) 

        ) 

       [2] => Array 
        (
         [id] => cop 
         [title] => Cash on pickup 
         [description] => Pay your order in cash as you pick it up at our store. 
         [icon] => 
         [chosen] => 
         [order_button_text] => Place order 
         [enabled] => yes 
         [testmode] => 
         [instructions] => Pay with cash on pickup at [Store address]. 
         [account_details] => Array 
          (
          ) 

         [settings] => Array 
          (
          ) 

        ) 


      ) 

    ) 

+1

究竟是什麼問題? – henrybbosa

+0

1.請編輯你的問題,使其可讀(在你的問題下有一個'edit' linkk,_use it!_)。 2.「show data」的意思是什麼_exactly_? 3.你在這裏有什麼具體問題? – arkascha

+0

請向我們展示您正在使用的數據以及您想要實現的內容 – fafl

回答

0

假設「新來港定居人士計數」當你把它叫做是「new_arrivals」數組中元素的個數,這個工程:

$data = json_decode(... your json string ...); 
echo count($data->new_arrivals); 

編輯:這真的很難理解什麼你要。這個怎麼樣?

echo "<table><tr>"; 
foreach ($data["new_arrivals"][0] as $key => $value) { 
    if ($key == "category_ids") continue; 
    echo "<th>" . $key . "</th>"; 
} 
echo "</tr>"; 
foreach ($data["new_arrivals"] as $row) { 
    echo "<tr>"; 
    foreach ($row as $key => $value) { 
     if ($key == "category_ids") continue; 
     echo "<td>" . $value . "</td>"; 
    } 
    echo "</tr>"; 
} 
echo "</table>"; 
+0

不喜歡這種類型的 我想終於接(應該是顯示所有數據) –

+0

你能不能給你想要的結果的例子嗎? – fafl

+0

應該像下面.... <表式= 「寬度:100%」> ID庫存 URL描述標題 IMG類型價格 REGULAR_PRICE sale_price category_ids created_at average_rating total_sales featured 應顯示所有記錄..在循環明智 –