gpt4 book ai didi

php - 如何回显数组中的项目数?

转载 作者:行者123 更新时间:2023-12-02 07:13:47 24 4
gpt4 key购买 nike

我知道的一个新手问题。

我正在使用 Zend 框架,并从 Controller 发送一个数组:

$this->view->googleArray = $viewFeedArray;

在 View 中,我有一个 foreach 循环,它用数组内容填充一个表。

<?php 
foreach($this->googleArray as $row) { ?>
<tr>
<td><?php echo $row['when']; ?></td>
...
...
</tr>
<?php
}
?>

一切正常。在表格的顶部,我想列出数组中的项目数。

类似的东西(不起作用):

 <?php echo $this->googleArray->totalResults; ?> event(s) found

我该怎么做?

谢谢!

最佳答案

试过这个吗?

<?php echo count($this->googleArray); ?> event(s) found

关于php - 如何回显数组中的项目数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2983358/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com