0
我使用woocommerce API在我的PHP代碼無法讀取
在PHP(woocommerce)陣列領域,但我有我的代碼有問題
我如何可以訪問我的數組內容
我想回聲每個字段我的陣列的
$cats = $client->products->get_categories();
$arrlength = count($cats);
for($x = 0; $x < $arrlength; $x++) {
echo $userid,$cats[$x]['name']) ;
}
結果是:
Array
(
[product_categories] => Array
(
[0] => Array
(
[id] => 23
[name] => Business
[slug] => business
[parent] => 21
[description] =>
[display] => default
[image] =>
[count] => 5
)
[1] => Array
(
[id] => 24
[name] => Business
[slug] => business-woman
[parent] => 22
[description] =>
[display] => default
[image] =>
[count] => 7
)
[2] => Array
(
[id] => 25
[name] => Casual
[slug] => casual
[parent] => 22
[description] =>
[display] => default
[image] =>
[count] => 7
)
[3] => Array
(
[id] => 26
[name] => Casual
[slug] => casual-men
[parent] => 21
[description] =>
[display] => default
[image] =>
[count] => 3
)
[4] => Array
(
[id] => 20
[name] => Featured
[slug] => featured
[parent] => 0
[description] => FEATURED PRODUCT
[display] => default
[image] =>
[count] => 10
)
[5] => Array
(
[id] => 21
[name] => Men
[slug] => men
[parent] => 0
[description] =>
[display] => default
[image] =>
[count] => 5
)
[6] => Array
(
[id] => 22
[name] => Women
[slug] => women
[parent] => 0
[description] =>
[display] => default
[image] =>
[count] => 12
)
)
)
感謝您對快速重放 但我得到這個錯誤 未定義指數:命名 未定義指數:蛞蝓 未定義指數:父 未定義指數:描述 未定義index:display 未定義索引:image 未定義索引:count –