如何在函数中获得用户好听的名字?目前我用头像获得了它,但不知道如何获得用户好听的名字:
$table = $wpdb->prefix . "thumbsup_info";
$result = $wpdb->get_results("SELECT userid FROM $table WHERE postid = '$postid' LIMIT 10", ARRAY_A);
$total_user = $wpdb->num_rows;
for($i=0; $i <$total_user ; $i++)
{
$userid.= get_avatar($result[$i]['userid'],100);
}
return $userid;
Run Code Online (Sandbox Code Playgroud) 我有一个数组$ captions我想检查内部是否至少有一个值.数组看起来像这样:
Array
(
[0] => 84
[1] =>
[2] => 82
[3] =>
[4] =>
[5] =>
[6] =>
[7] =>
[8] =>
[9] =>
)
Run Code Online (Sandbox Code Playgroud)
我的方式检查是否有"超过0","超过1"......
if (count($captions) > 0) { echo '<br>bigger than 0';}
if (count($captions) === 1) {echo '<br>is 1';};
if (count($captions) > 1) {echo '<br>gbigger than 1';};
if (count($captions) > 2) {echo '<br>bigger than 2';}
Run Code Online (Sandbox Code Playgroud)
但是:它给了我这个数组以上结果:
bigger than 0
bigger than 1
bigger than 2
Run Code Online (Sandbox Code Playgroud)
"大于2"不应该,因为数组只包含两个值?我错了什么?