<?php
if(!$selectedDay)
{
$selectedDay = date('d');
}
if(!$selectedMonth)
{
$selectedMonth = date('m');
}
if(!$selectedYear)
{
$selectedYear = date('Y');
}
//获得指定月份的第一天是星期几?
$firstday = date('w',mktime(0,0,0,$selectedMonth,1,$selectedYear));
$lastday = 31;
do
// have to perform a loop to test from 31 backwards using this
//to see which is the last day of the month
{
//注意控制循环条件,先获得月份的第一天,再获得中间测试天
$monthOrig = date('m',mktime(0,0,0,$selectedMonth,1,$selectedYear));
$monthTest = date('m',mktime(0,0,0,$selectedMonth,$lastday,$selectedYear));
if($monthTest != monthOrig)
{
$lastday -=1; }
}
while ($monthTest != monthOrig);
$monthName = date('F',mktime(0,0,0,$selectedMonth,1,$selectedYear));
//dafine the month Name
if($DEBUGGING_SET) //if语句判断环境变量中是否定义了$DEBUGGIG_SET常量
{
print("<p>lst day of the lst week of $selectedMonth $selectedYear is $firstday (from 0 to 6 )<p>\n");
print("The last day of $selectedMonth $selectedYear is $lastday\n<p>");
}
$days[0] ='Sun';
$days[1] ='Mon';
$days[2] ='Tue';
$days[3] ='Wed';
$days[4] ='Thu';
$days[5] ='Fri';
$days[6] ='Sat';
//定义星期的显示方式$dayRow = 0; //标识天数在表格中应该显示的位置。
print("<table bgcolor=\"#FFFFFF\">"); //背景色
print("<caption valign=\"center\"><b>$monthName $selectedYear</b></caption>");
//显示出指定的年份和月份print("<tr>\n");for($i=0; $i<7;$i++)
{
print("<td width =10%>$days[$i]</td>\n");
}
print("</tr>\n");
print("<tr>\n");
while($dayRow <$firstday)
{
print("<td><!-- This day in last month --></td>");
$dayRow ++; //$dayRow的值加1
} $day = 0; //变量$day用以存储应显示的天数。初始值为0 。
if($frametarget)
{
$targetString = 'target = '.$frametarget;
}
else
{
$targetString='welcome.htm';
}
while($day < $lastday)
{
if(($dayRow % 7) == 0) //判断变量$dayRow可否被整除。
{
print("</tr>\n<tr>\n>");
}
$day ++;
print("<td><a href = $targetString>$day</a><td>");
$dayRow ++;
}
print("\n</tr>\n</table>\n");
?>结果:Fatal error: Maximum execution time of 30 seconds exceeded in D:\PHPnow\htdocs\riqi\rq5.php on line 24检查好多篇还是看不出来那里错``请帮帮忙`
问题补充:检查好多篇还是看不出来那里错``请帮帮忙` 还有我的系统时间和我php
if(!$selectedDay)
{
$selectedDay = date('d');
}
if(!$selectedMonth)
{
$selectedMonth = date('m');
}
if(!$selectedYear)
{
$selectedYear = date('Y');
}
//获得指定月份的第一天是星期几?
$firstday = date('w',mktime(0,0,0,$selectedMonth,1,$selectedYear));
$lastday = 31;
do
// have to perform a loop to test from 31 backwards using this
//to see which is the last day of the month
{
//注意控制循环条件,先获得月份的第一天,再获得中间测试天
$monthOrig = date('m',mktime(0,0,0,$selectedMonth,1,$selectedYear));
$monthTest = date('m',mktime(0,0,0,$selectedMonth,$lastday,$selectedYear));
if($monthTest != monthOrig)
{
$lastday -=1; }
}
while ($monthTest != monthOrig);
$monthName = date('F',mktime(0,0,0,$selectedMonth,1,$selectedYear));
//dafine the month Name
if($DEBUGGING_SET) //if语句判断环境变量中是否定义了$DEBUGGIG_SET常量
{
print("<p>lst day of the lst week of $selectedMonth $selectedYear is $firstday (from 0 to 6 )<p>\n");
print("The last day of $selectedMonth $selectedYear is $lastday\n<p>");
}
$days[0] ='Sun';
$days[1] ='Mon';
$days[2] ='Tue';
$days[3] ='Wed';
$days[4] ='Thu';
$days[5] ='Fri';
$days[6] ='Sat';
//定义星期的显示方式$dayRow = 0; //标识天数在表格中应该显示的位置。
print("<table bgcolor=\"#FFFFFF\">"); //背景色
print("<caption valign=\"center\"><b>$monthName $selectedYear</b></caption>");
//显示出指定的年份和月份print("<tr>\n");for($i=0; $i<7;$i++)
{
print("<td width =10%>$days[$i]</td>\n");
}
print("</tr>\n");
print("<tr>\n");
while($dayRow <$firstday)
{
print("<td><!-- This day in last month --></td>");
$dayRow ++; //$dayRow的值加1
} $day = 0; //变量$day用以存储应显示的天数。初始值为0 。
if($frametarget)
{
$targetString = 'target = '.$frametarget;
}
else
{
$targetString='welcome.htm';
}
while($day < $lastday)
{
if(($dayRow % 7) == 0) //判断变量$dayRow可否被整除。
{
print("</tr>\n<tr>\n>");
}
$day ++;
print("<td><a href = $targetString>$day</a><td>");
$dayRow ++;
}
print("\n</tr>\n</table>\n");
?>结果:Fatal error: Maximum execution time of 30 seconds exceeded in D:\PHPnow\htdocs\riqi\rq5.php on line 24检查好多篇还是看不出来那里错``请帮帮忙`
问题补充:检查好多篇还是看不出来那里错``请帮帮忙` 还有我的系统时间和我php
$monthOrig = date('m',mktime(0,0,0,$selectedMonth,1,$selectedYear));
$monthTest = date('m',mktime(0,0,0,$selectedMonth,$lastday,$selectedYear));
if($monthTest != monthOrig)