Php 试图在变量中显示多个类别?

Php 试图在变量中显示多个类别?,php,wordpress,Php,Wordpress,我用过- <?php the_category( ' & ' ); ?> 以-ie格式显示多个类别;一般新闻和特写 我试图将其作为一个变量添加,并且只能输出一个类别,但不能再输出更多,即使文章是在多个类别中 我现有的代码是- $post_category = get_the_category(); $html .= '<p>Posted in' . $post_category[0]->cat_name . '</p>'; $post_

我用过-

<?php the_category( ' & ' ); ?>

以-ie格式显示多个类别;一般新闻和特写

我试图将其作为一个变量添加,并且只能输出一个类别,但不能再输出更多,即使文章是在多个类别中

我现有的代码是-

$post_category = get_the_category();

$html .= '<p>Posted in' . $post_category[0]->cat_name . '</p>';
$post_category=get_the_category();
$html.='postedin'$post_类别[0]->类别名称。'

",;
我如何才能将其输出为类似的内容-发布在一般新闻和特写中

谢谢

请参见获取类别列表()函数


试过了。只是在变量中为我抛出一个错误