我有以下编码的json数组:
function getMostActive($link) {
$query = "SELECT username AS staff, COUNT(*) As Total FROM vloer_action_logs WHERE task_type = 'job_status_change' AND accessed_time >= '2019-12-31' AND accessed_time <= '2020-01-06'
Group by username ORDER BY 2 DESC";
$result = mysqli_query($link, $query);
if (!$result)
die(mysqli_error($link));
$jsonData = array();
while ($array = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
$jsonData[] = $array;
}
return json_encode($jsonData);
}
我想在表格中打印此数据。已尝试以下方法
$getMostActive = json_decode(getMostActive($link),true);
<?php foreach ($getMostActive as $key=>$value) { ?>
<tr>
<td class="dark"><?php echo $value['Floor'];?> </td>
<td class="end"><?php echo $value['Total'];?></td>
</tr>
但它扔给我的错误:
尝试在 /var/www/html/用户/报告/报告/报告中获取非对象的属性“楼层.php
我怎么能解决这个问题。提前致谢
慕神8447489
慕森王
慕村9548890