Php数组剥离html

Php数组剥离html,php,Php,如果我不使用内爆,我的html标签就不会显示。为什么?我应该在数组中使用什么,这样就不会发生这种情况 if( get_field('additional_specifications') ) { while ( have_rows('additional_specifications') ) : the_row(); $addSpec[] = '<tr><td>' . get_sub_field('spec_name') . '</td><

如果我不使用内爆,我的html标签就不会显示。为什么?我应该在数组中使用什么,这样就不会发生这种情况

if( get_field('additional_specifications') ) {
    while ( have_rows('additional_specifications') ) : the_row();
    $addSpec[] = '<tr><td>' . get_sub_field('spec_name') . '</td><td>' . get_sub_field('spec_value') . '</td></tr>'; 

endwhile;
    $spec= implode($addSpec);

$content .=  $spec; 
}

if ($content) {
echo '<table class="spec-table">',$content,'</table>';
}
if(获取_字段(“附加_规范”)){
while(have_rows(‘附加_规范’):the_row();
$addSpec[]=''.get_sub_字段('spec_name')。'.get_sub_字段('spec_value');
结束时;
$spec=内爆($addSpec);
$content.=$spec;
}
如果($content){
回显“”,$content“”;
}
if(获取\u字段(“附加\u规范”)){
while(have_rows(‘附加_规范’):the_row();
$content.=''.get_sub_字段('spec_name')。'.get_sub_字段('spec_value');
结束时;
}
如果($content){
回显“.$content.”;
}
?>

您不能将
$addSpec[]=
替换为
$content.=
如果($content){echo'',$content'';}它是错误sytax,必须是echo''$内容",@buivankim2020实际上可以使用逗号,但“.”可能是更好的语法@Memor-X$content.=非常有效,谢谢。我想知道为什么有人投票反对我。
if( get_field('additional_specifications') ) {
    while ( have_rows('additional_specifications') ) : the_row();
        $content .= '<tr><td>' . get_sub_field('spec_name') . '</td><td>' . get_sub_field('spec_value') . '</td></tr>'; 
endwhile;

}

if ($content) {
    echo '<table class="spec-table">'. $content .'</table>';
 }
 ?>