班得瑞 童年 php 取得瑞年与平年的天数的代码
程序员文章站
2022-04-20 19:11:02
...
复制代码 代码如下:
// 取得某月天数,可用于任意月份
function getDays($month, $year)
{
switch($month)
{
case 4:
case 6:
case 9:
case 11:
$days = 30;
break;
case 2:
if ($year%4==0)
{
if ($year 0==0)
{
$days = $year@0==0 ? 29 : 28;
}
else
{
$days =29;
}
}
else
{
$days = 28;
}
break;
default:
$days = 31;
break;
}
return $days;
}
**
* 根据时间戳取得对应的星期几
*
* @param int $time_stamp 时间戳
*/
function getWeek($time_stamp)
{
$week_num = date("w",$time_stamp);
switch($week_num)
{
case "0":
$week = "日";
break;
case '1':
$week = "一";
break;
case '2':
$week = "二";
break;
case '3':
$week = "三";
break;
case '4':
$week = "四";
break;
case '5':
$week = "五";
break;
case '6':
$week = "六";
break;
}
Return $week;
}
以上就介绍了班得瑞 童年 php 取得瑞年与平年的天数的代码,包括了班得瑞 童年方面的内容,希望对PHP教程有兴趣的朋友有所帮助。