我想从下面的数组中获取term_taxonomy_id
,但每次都会出现以下错误。
可捕获的致命错误:类WP_Error的对象不能在C中转换为字符串.
Array
(
[0] => stdClass Object
(
[term_id] => 5
[name] => fonts
[slug] => fonts
[term_group] => 0
[term_taxonomy_id] => 5
[taxonomy] => category
[description] =>
[parent] => 0
[count] => 2
[object_id] => 96
[cat_ID] => 5
[category_count] => 2
[category_description] =>
[cat_name] => fonts
[category_nicename] => fonts
[category_parent] => 0
)
)
发布于 2012-12-06 23:58:06
你想得到什么错误?试试这个:
foreach($yourarray as $term){
echo $term->term_taxonomy_id;
}
发布于 2022-06-20 03:05:04
最佳简便方式
$array = json_decode(json_encode($object), true);
发布于 2022-10-19 04:43:45
你也可以尝试:
echo $array[0]->term_taxonomy_id;
https://stackoverflow.com/questions/13759061
复制相似问题