常用函数-get_approved_comments()

0条评论

常用函数-get_approved_comments()

说明

获取文章编号并返回一个对象数组,表示已经被提交并批准的评论。

用法

<?php    
  $comment_array = get_approved_comments($post_id);   
?>  

示例

本例将输出一个简单的评论编号和相应的文章编号列表。

<?php     
   $postID = 1;     
   $comment_array = get_approved_comments(1);       

   foreach($comment_array as $comment){        
      echo $comment->comment_ID." => ".$comment->comment_post_ID."\n";     
   }  
?>

参数

$post_id

(整数)(必需)文章编号,该文章的评论将被检索

默认值:None

发表新评论

此内容将保密,不会被其他人看见。
  • 自动将网址与电子邮件地址转变为链接。
  • 允许HTML标签:<a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • 自动断行和分段。

更多关於格式化选项的信息

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.