-2

我是 PHP 新手。我正在尝试用我从其他人的工作中拼凑起来的代码片段来制作一个巧合发生率 (IC) 计算器。除了发布到表格的部分外,一切正常。我希望它在 50 岁后停止制造新细胞。我已经研究了几个小时并尝试了其他几种方法,但我自己也很困惑。请问有什么帮助吗?

这是编写表格的代码:

<?php
  if ( $showTable ) {
    // display tabulated values
    echo "<table class=\"trans\" width=\"1000\" border=\"1\" cellpadding=\"0\">"; 
    for ( $i = 1; $i < 50; $i++ ) {
         echo "<tr>"; 
         for ($c=0; $c <$cols; $c++) 
         {
         echo "<td>"; 
         echo($cells.': '.round($history[$i+$c], 3));
         $cells++;
         echo "</td>"; 
         }
    }
    echo "</tr>";
     $i += $c; 
  }
     echo "</table>";  
?>
4

1 回答 1

1

如果我理解正确的话,

<?php
  if ( $showTable ) {
    // display tabulated values
    echo "<table class=\"trans\" width=\"1000\" border=\"1\" cellpadding=\"0\">"; 

    for ( $i = 1; $i < 50; $i++ ) { // 50 rows will be created
    echo "<tr>";      
         for ($c=0; $c <50; $c++) // each row will contain 50 <td>
         {
         echo "<td>"; 
         echo($cells.': '.round($history[$i+$c], 3));
         $cells++;
         echo "</td>";
         $i += $c;
         }
     echo "</tr>";    
    }


  }
     echo "</table>";  
?>
于 2012-11-05T06:43:39.690 回答