我写过一个。
<?php
function clnd($year,$month){
echo '<table width="245" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#000000"
style="font-family: Verdana;font-size: 12px;">
<tr bgcolor="#ffffff" align="center" height="20"><td colspan="7"><strong>'
.date("F",strtotime("$year-$month-1")).
'</strong></td></tr>
  <tr align="center" bgcolor="#eeeeee"> 
<td width="35" height="18"><strong><font color="#FF0000">Sun</font></strong></td>
<td width="35" height="18"><strong>Mon</strong></td>
<td width="35" height="18"><strong>Tue</strong></td>
<td width="35" height="18"><strong>Wed</strong></td>
<td width="35" height="18"><strong>Tur</strong></td>
<td width="35" height="18"><strong>Fri</strong></td>
<td width="35" height="18"><strong>Sat</strong></td>
  </tr>';
$i=1;
$t1=date("w",strtotime("$year-$month-1"));
echo '<tr align="center" bgcolor="#ffffff" height="20">';
for ($i=0;$i<$t1;$i++){
echo '<td>&nbsp;</td>';
}
$t2=date("t",strtotime("$year-$month-1"));
for ($i=1;$i<=$t2;$i++){
echo "<td";
if (strtotime("today 0:0:0")==strtotime("$year-$month-$i")){
echo ' bgcolor="#cceeff"';
}
echo ">$i</td>";
if (($i+$t1)%7==0){
echo '</tr>';
if ($i!=$t2){
echo '<tr align="center" bgcolor="#ffffff" height="20">';
$t3='</tr>';
}else{
$t3='';
}
}

}
if ($t3==''){
echo '</table>';
}else{
$t1=($i+$t1)%7;
if ($t1==0){
echo '<td>&nbsp;</td>';
}else{
for ($i=1;$i<=7-$t1+1;$i++){
echo '<td>&nbsp;</td>';
}
}
echo $t3.'</table>';
}
}
clnd(2004,4);
?>