Php into HTML table


Php into HTML table

可能是一个非常简单的问题,但是如何将这些日期值插入html表列中?

<?php
  $startdate = strtotime("Monday");
  $enddate = strtotime ("+3 weeks", $startdate);
  while ($startdate < $enddate) {
  echo date("M d", $startdate),"<br>";
  $startdate = strtotime("+1 week", $startdate);
  }

可以尝试这样的事情

$startdate = strtotime("Monday");
$enddate = strtotime ("+3 weeks", $startdate);
echo '<table border="1">';
while ($startdate < $enddate) {
    echo '<tr><td>'.date("M d", $startdate).'</td></tr>';
    $startdate = strtotime("+1 week", $startdate);
}
echo '</table>';