|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
培训的第三阶段,开始接触MYSQL,设计数据库,学习PHP如何去连接MYSQL数据库。对于MYSQL,我并不陌生,因为学校开设了Linux系统的课程,对于数据库的操作。 <?php
//calendar.php
//Check if the month and year values exist
if ((!$_GET['month']) && (!$_GET['year'])) {
$month = date ("n");
$year = date ("Y");
} else {
$month = $_GET['month'];
$year = $_GET['year'];
}
//Calculate the viewed month
$timestamp = mktime (0, 0, 0, $month, 1, $year);
$monthname = date("F", $timestamp);
//Now let's create the table with the proper month
?>
<table style="width: 105px; border-collapse: collapse;" border="1" cellpadding="3" cellspacing="0" bordercolor="#000000">
<tr>
<td colspan="7" class="calendartodayoff" >
<span style="font-weight: bold;"><?php echo $monthname . " " . $year; ?></span>
</td>
</tr>
<tr>
<td class="calendartodayoff" >
<span style="font-weight: bold;">Su</span>
</td>
<td class="calendartodayoff" >
<span style="font-weight: bold;">M</span>
</td>
<td class="calendartodayoff" >
<span style="font-weight: bold;">Tu</span>
</td>
<td class="calendartodayoff" >
<span style="font-weight: bold;">W</span>
</td>
<td class="calendartodayoff" >
<span style="font-weight: bold;">Th</span>
</td>
<td class="calendartodayoff" >
<span style="font-weight: bold;">F</span>
</td>
<td class="calendartodayoff" >
<span style="font-weight: bold;">Sa</span>
</td>
</tr>
<?php
$monthstart = date("w", $timestamp);
$lastday = date("d", mktime (0, 0, 0, $month + 1, 0, $year));
$startdate = -$monthstart;
//Figure out how many rows we need.
$numrows = ceil (((date("t",mktime (0, 0, 0, $month + 1, 0, $year)) + $monthstart) / 7));
//Let's make an appropriate number of rows...
for ($k = 1; $k <= $numrows; $k++){
?><tr><?php
//Use 7 columns (for 7 days)...
for ($i = 0; $i < 7; $i++){
$startdate++;
if (($startdate <= 0) || ($startdate > $lastday)){
//If we have a blank day in the calendar.
?><td style="background: #FFFFFF;"> </td><?php
} else {
if ($startdate == date("j") && $month == date("n") && $year == date("Y")){
?><td class="calendartodayoff" -" . $month . "-" . $startdate; ?>',event);" ><?php echo date ("j"); ?></td><?php
} else {
?><td class="calendaroff" -" . $month . "-" . $startdate; ?>',event);" ><?php echo $startdate; ?></td><?php
}
}
}
?></tr><?php
}
?>
</table>怎么配置呢 ,问最好的老实百度,问啥都有答案。所以用好搜索引擎是学好的令1个关键,程序会出各样的问题,没有1个人可能会碰到所有的问题,所有就可以问百度这个大家精华的集合了。 |
|