0

我想生成一个包含动态列和行的表

例如,如果我有一个数组

1.1, 1.2, 1.3, 1.4
2.1, 2.2, 2.3, 2.4
3.1, 3.2, 3.3, 3.4

当前显示 1.1 1.2 1.3 1.4 然后 2.1 2.2 2.3 2.4 ...等

但我想显示 1.1 ,2.1, 3.1 然后 1.2 2.2 2.3 ...等

而不是显示该特定行的所有行值。我想一次显示所有列值。

在 c++ 中,我知道你必须使用嵌套的 for 循环才能实现这一点

for (int i=0; i< col_size; i++)
{
    for (int j=0; j < row_size; j++)
    {
        cout << a[i][j];
    }
}

但是如何使用 Zend 框架加上 im 也使用 zend paginator 来完成

有什么方法可以用来确定列的大小吗?

我当前的代码是

      <div class ="outcome">
<?php

foreach($this->paginator as $row){
              $this->providerSearchResults($row); // using custom helper

}
echo '</ul>';
$params = array('location' => $this->location,'industryType' => $this->industryType);  // used to pass to the paginationcontrol
echo $this->paginationControl($this->paginator,'Sliding','paginationcontrol.phtml',$params);

</div>

我的自定义助手

    public function providerSearchResults($row)
    {
          echo $row['businessName']
          echo $row['cpuPrice']
          echo $row['hdPrice'];
          .....
          echo $row['ramPrice];


}

非常感谢!

4

1 回答 1

0

您也可以在 Php 中使用嵌套的 for 循环 但是您也可以选择 vprintf、printf 或 fprintf .. 您可以在 forloop 中使用

forloop printf("%d%d%d",i)

于 2011-09-27T09:46:16.733 回答