复制代码 代码如下:
function getDays() {
putenv("TZ=Asia/Chongqing");
$by = 2006;
$bm = 7;
$bd = 7;
$rday="";
$today = getdate();
$by = $today[year] - $by;
$bm = $today[mon] - $bm;
$bd = $today[mday] - $bd;
if ($bd < 0) {
$bd = 30 + $bd;
$bm--;
}
if ($bm < 0) {
$bm = 12 + $bm;
$by--;
}
#print $by."-".$bm."-".$bd;
if ($by > 0) {
$rday = $by . "岁";
}
if ($bm == 0&&$bd == 0){
$rday .="生日";
}else{
if ($bm == 0){
$rday.="零".$bd."天";
}elseif ($bd == 0){
$rday.=$bm."个月整";
}else{
$rday.=$bm."个月".$bd."天";
}
}
return $rday;
}
复制代码 代码如下:
<?php echo getDays();?>
新闻热点
疑难解答