WordPress: Function Reference/get approved comments:修订间差异
来自站长百科
(新页面: ==Description== Takes post ID and returns an array of objects that represent comments that have been submitted ''and'' approved. ===Usage=== <pre> <?php $comment_array = get_approved_...) |
无编辑摘要 |
||
第1行: | 第1行: | ||
==Description== | ==Description== | ||
== 描述== | |||
Takes post ID and returns an array of objects that represent comments that have been submitted ''and'' approved. | Takes post ID and returns an array of objects that represent comments that have been submitted ''and'' approved. | ||
获得文章ID并且返回an array of objects代表已经递交''并且''审核后的评论。 | |||
===Usage=== | ===Usage=== | ||
== 用法 == | |||
<pre> | |||
<?php | |||
$comment_array = get_approved_comments($post_id); | |||
?> | |||
</pre> | |||
<pre> | <pre> | ||
第11行: | 第22行: | ||
==Example== | ==Example== | ||
== 例子 == | |||
In this example we will output a simple list of comment IDs and corresponding post IDs. | In this example we will output a simple list of comment IDs and corresponding post IDs. | ||
在这个例子中,我们会输出评论IDs和相应的文章IDs的一个一个简单的列表。 | |||
<pre> | |||
<?php | |||
$postID = 1; | |||
$comment_array = get_approved_comments(1); | |||
foreach($comment_array as $comment){ | |||
echo $comment->comment_ID." => ".$comment->comment_post_ID."\n"; | |||
} | |||
?> | |||
</pre> | |||
<pre> | <pre> | ||
第27行: | 第56行: | ||
==Parameters== | ==Parameters== | ||
== 参数 == | |||
{{Parameter|$post_id|integer|The ID of the post to retrieve comments from.}} | {{Parameter|$post_id|integer|The ID of the post to retrieve comments from.}} | ||
{{Parameter|$post_id|integer|返回评论形式的文章ID。}} |
2008年7月21日 (一) 11:56的版本
Description
描述
Takes post ID and returns an array of objects that represent comments that have been submitted and approved.
获得文章ID并且返回an array of objects代表已经递交并且审核后的评论。
Usage
用法
<?php $comment_array = get_approved_comments($post_id); ?>
<?php $comment_array = get_approved_comments($post_id); ?>
Example
例子
In this example we will output a simple list of comment IDs and corresponding post IDs.
在这个例子中,我们会输出评论IDs和相应的文章IDs的一个一个简单的列表。
<?php $postID = 1; $comment_array = get_approved_comments(1); foreach($comment_array as $comment){ echo $comment->comment_ID." => ".$comment->comment_post_ID."\n"; } ?>
<?php $postID = 1; $comment_array = get_approved_comments(1); foreach($comment_array as $comment){ echo $comment->comment_ID." => ".$comment->comment_post_ID."\n"; } ?>