关于$DEBUGGING_SET

aivera 2007-09-03 11:12:49
我在书上看到的代码其中有段if($DEBUGGING_SET)不知道是什么意思在GOOGLE上也没有找到答案,哪位高人给解释以下,谢谢了.还有就是 if($frametarget)一直没能很好的理解意思我以为就是自己定义了1个打开窗口的变量对吗?


if (!$selectedDay ) {
$selectedDay = date('d');
}
if (!$selectedMonth) {
$selectedMonth = date('m');
}
if (!$selectedYear) {
$selectedYear = date('Y');
}

# get the first day of the week!
$firstday = date('w',mktime(0,0,0,$selectedMonth,1,$selectedYear));

# have to perform a loop to test from 31 backwards using this
# to see which is the last day of the month
$lastday = 31;
do {
# *Sigh* recursion would have been more fun here.
$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));

if($DEBUGGING_SET) {
print("<p>first day of the first 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<=6; $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 += 1;
}

$day = 0;
if($frametarget) {
$targetString = 'target = '.$frametarget;
} else {
$targetString = '';
}

while($day < $lastday) {
if(($dayRow % 7) == 0) {
print("</tr>\n<tr>\n");
}
$adjusted_day = $day+1;
print("<td><a href=\"/php3/eventCalendar/event_content.phtml?month=$selectedMonth&day=$adjusted_day&year=$selectedYear\" $targetString>$adjusted_day</a></td>");
$day += 1;
$dayRow += 1;
}
print("\n</tr>\n</table>\n");
# print("$selectedMonth");
?>
...全文
110 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
aivera 2007-09-03
  • 打赏
  • 举报
回复
非常感谢你的解答~!!
xuzuning 2007-09-03
  • 打赏
  • 举报
回复
if($DEBUGGING_SET) {
print("<p>first day of the first week of $selectedMonth $selectedYear is $firstday (from 0 to 6) <p>\n");
print("The last day of $selectedMonth $selectedYear is $lastday\n<p>");
}

$DEBUGGING_SET 为调试程序开关,当其不为空时,将输出调试信息


if($frametarget) {
$targetString = 'target = '.$frametarget;
} else {
$targetString = '';
}
如果$frametarget非空则$frametarget为目标窗口名

21,886

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧