0
今日からデータベースの最も古いレコードまでの月のリストを作成しようとしています。 ループが最古の月になる前に停止することを除いて、素晴らしいことです。ここに私のコードは次のとおりです。PHPブログアーカイブの月間をループする
echo $oldest_entry; //2012-01-31
$end = strtotime($oldest_entry);
$month = strtotime(date('Y-m-d'));
$year = "";
while($month >= $end)
{
if(date('Y', $month) != $year){
echo "<b>".date('Y', $month)."</b><br/>";
$year = date('Y', $month);
}
echo date('F', $month)."<br/>";
$month = strtotime("-1 month", $month);
}
それは出力:
月
2月
1月に取得していません。私はここで間違って何をしていますか?私は=を>に追加することでこれを修正すると思ったが、そうしなかった。