【发布时间】:2019-10-28 01:43:03
【问题描述】:
我正在尝试在 woocommerce 中获取产品项目的元数据。我试过循环遍历对象,但似乎无法绕过。格式如下所示。
array(52) { [0]=> object(WC_Meta_Data)#3939 (2) { ["current_data":protected]=>
array(3) { ["id"]=> int(2631) ["key"]=> string(14) "slide_template" ["value"]=> string(7)
"default" } ["data":protected]=> array(3) { ["id"]=> int(2631) ["key"]=> string(14)...
............ etc
我尝试使用以下方法循环获取项目无济于事。
$theitem = ($product->get_meta_data() );
var_dump($theitem);
如何循环获取项目值?我试过foreach 甚至有点索引,但无济于事。
【问题讨论】:
-
你试过
print_r()。它提供的是否超过var_dump()?
标签: php wordpress woocommerce metadata