php获取几号为本月第几周
function getWeek($year = null, $month = null, $day = null) { if (empty($year)) { $year = date('Y', time()); // 获取本年 } if (empty($month)) { $month = date('m', time()); // 获取本月 } if (empty($day)) { $day = date('d', time()); } $firstday = date('w', mktime(0, 0, 0, $month, 1, $year)); //本月1号星期数 $firstweek = 7 - $firstday; // 第1周天数 return ceil(($day - $firstweek) / 7) + 1; }