2015-09-11 225 views
-1

我正在使用wordpress。我想用一个物体看起来像从对象中获取对象名称

WC_Product_Variable Object 
(
[children] => 
[total_stock] => 
[id] => 22 
[post] => WP_Post Object 
    (
     [ID] => 22 
     [post_author] => 1 
     [post_date] => 2015-09-02 11:07:42 
     [post_date_gmt] => 2015-09-02 11:07:42 
     [post_content] => 
    ) 
) 

现在,我想WC_Product_Variable的名字,所以我如何从一个对象得到这个名字吗?

+1

你有一个对象。不是数组 – Rizier123

+1

相关:http://stackoverflow.com/q/30680938/3933332 – Rizier123

+0

是的,它的一个对象如何获取对象的名称? –

回答

-2

试试这个。

CONVER对象要阵列

$array = (array) $yourObjectname;