Calendar written in php_PHP tutorial

WBOY
Release: 2016-07-13 16:54:24
Original
1036 people have browsed it

网上有很多JavaScript编写的日历,这种日历读取的是本地的时间,可能会不准确。所以想找一个用php编写的,能读取服务器时间的日历,但是一直都找不到合适的,于是我自己尝试着写了一个。
代码
$mnow=(isset($HTTP_GET_VARS['month']) && intval($HTTP_GET_VARS['month'])>0 && intval($HTTP_GET_VARS['month'])<13)?intval($HTTP_GET_VARS['month']):date("m");
$ynow=(isset($HTTP_GET_VARS['year']) && intval($HTTP_GET_VARS['year'])>1969 && intval($HTTP_GET_VARS['year'])<2038)?intval($HTTP_GET_VARS['year']):date("Y");
$mtime=mktime(0,0,0,$mnow,date("d"),$ynow);
$f=date("w",mktime(0,0,0,$mnow,1,$ynow))-1;
echo "

";
echo "";
echo "";
for($i=0;$iif($i%7==0)echo "";
echo "";
if($i>$f)echo $i-$f;
echo "";
if($i%7==6)echo "
";
}
if($i%7<6 && $i%7>0)echo "";
if($i%7==6)echo "";
echo "
<".$ynow."><".date("M",$mtime).">
SMTWTFS
";
?>

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/631753.htmlTechArticle网上有很多JavaScript编写的日历,这种日历读取的是本地的时间,可能会不准确。所以想找一个用php编写的,能读取服务器时间的日历,但是...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!