0
這導致了一個不斷循環,幾個小時後,現在我太累了,找不到問題。 這應該是結果: <li><a href="monthly/13-7.php">Juli 2013</a></li><li><a href="monthly/13-8.php">August 2013</a></li>
PHP自動生成鏈接每月
這裏的代碼我公司生產的:
<?php
//array mit monaten
$monate = array(
1 => "Januar",
2 => "Februar",
3 => "März",
4 => "April",
5 => "Mai",
6 => "Juni",
7 => "Juli",
8 => "August",
9 => "September",
10 => "Oktober",
11 => "November",
12 => "Dezember"
);
//aktueller monat
$d = new DateTime('today');
$d->modify('first day of this month');
$lowmonth = $d->format('Y-m-d');
$highmonth = $d->format('ym');
$hm = (int)$highmonth;
$monat = date("n");
$pre = "<li><a href='monthly/";
$mid = ".php'>";
$end = "</a></li>";
$lm = 6;
$ly = 13;
$thim = $lm;
$thiy = $ly;
$ye = 0;
$dast = $ly.$lm;
$dat = (int)$dast;
while($dat < $hm)
{
if($thim == 12)
{
$ye = 1;
$thiy++;
}
else
{
$ye = 0;
}
if($ye = 1)
{
$thim = 1;
}
else
{
$thim++;
}
echo $pre.$thiy."-".$thim.$mid.$monate[$thim]." 20".$thiy.$end;
$dats = $thiy.$thim;
$dat = (int)$dats;
}
那麼你的問題是什麼? –
你的代碼是一個閱讀的災難。 – Axel
我討厭這裏的格式...做得更好,如果你想要得到沒有錯誤的「太多的代碼」......變老... –