怎么使用stdClass Object

2012年12月23日 发表评论 阅读评论
Array
(
    [0] => stdClass Object
        (
            [term_id] => 3
            [name] => apache
            [slug] => apache
            [term_group] => 0
            [term_taxonomy_id] => 3
            [taxonomy] => category
            [description] =>
            [parent] => 0
            [count] => 1
            [cat_ID] => 3
            [category_count] => 1
            [category_description] =>
            [cat_name] => apache
            [category_nicename] => apache
            [category_parent] => 0
        )

    [1] => stdClass Object
        (
            [term_id] => 1
            [name] => PHP
            [slug] => php
            [term_group] => 0
            [term_taxonomy_id] => 1
            [taxonomy] => category
            [description] =>
            [parent] => 0
            [count] => 1
            [cat_ID] => 1
            [category_count] => 1
            [category_description] =>
            [cat_name] => PHP
            [category_nicename] => php
            [category_parent] => 0
        )
二维数组stdClass Object是一组json对象,如果要调用里面的数据,就要这样调用,
foreach($categories as $key => $value){
  $cat = $value->term_id;
  $name = $value->name;
}
这样才能调用数据!

 


转载请注明来自:[MSN Spaces]http://msn.shandian.biz/495.html

  1. 本文目前尚无任何评论.