0

我这样做是为了获取类别名称,我得到了数组

Array ( [0] => stdClass Object ( [term_id] => 4 [name] => cinematography [slug] => cinematography [term_group] => 0 [avhec_term_order] => 1 [term_taxonomy_id] => 4 [taxonomy] => category [description] => [parent] => 0 [count] => 11 [object_id] => 2526 [cat_ID] => 4 [category_count] => 11 [category_description] => [cat_name] => cinematography [category_nicename] => cinematography [category_parent] => 0 ) )

为此我写了

  $category = get_the_category();
  print_r($category);

现在我如何将“[name] => cinematography”存储在变量中。

4

1 回答 1

0

我假设$category是你到达那里的数组,然后

$cinematography = $category[0]->cinematography;

https://drupal.org/node/1245956

于 2013-08-10T23:25:59.943 回答