我正在使用ThumbsUp V2 Voting Script而我正在尝试根据投票数显示帖子:
<?php $items = ThumbsUp::items()->orderby('votes_total')->get() ?>
这些值存储在mysql中,所以我想到了:
$display = mysql_query("SELECT * FROM banat");
$items = ThumbsUp::items($display)->orderby('votes_total')->get() ;
但是我确实做错了,因为它只是显示输出:
Array
答案 0 :(得分:1)
如果你得到一个数组,你必须循环它以显示数据。你不能只对一个数组的var做echo
。你应该有这样的东西:
foreach($items as $item)
{
echo $item;
}
答案 1 :(得分:1)
你的$items
是一个数组,我假设你试图
echo $items;
相反,你需要循环它:
foreach ($items as $item) {
// View the structure of `$item`
print_r($item);
}
如果您只希望$items
举行一件事,那么就这样做:
print_r($items[0]);