代码之家  ›  专栏  ›  技术社区  ›  Bireon

如何在html中解析php

  •  0
  • Bireon  · 技术社区  · 6 年前

    我试图将php查询解析为html,但是在html页面上 .

    $comments = get_comments( array('post_id' => $post->ID, 'status' => 'approve') );

    $html .= $comments;

    1 回复  |  直到 6 年前
        1
  •  0
  •   Gregor Ojstersek    6 年前

    从中可以看到 examples .

    作为 Tom J Nowell

    $args = array(
        'status'  => 'approve',
        'post_id' => $post->ID,
    );
    $comments = get_comments( $args );
    
    foreach ( $comments as $comment ) :
        $html .= $comment->comment_author . '<br />' . $comment->comment_content . '<br />';
    endforeach;