/**
*半月内每周二 四 六的时间 10点钟
*/
public function getTime()
{
$time = time();//时间
$now = date("w", $time);//获取今天的周几
$now = $now == 0 ? 7 : $now;//修正周日
//当天零点整的时间戳
$day = strtotime(date('Y-m-d', $time));
//计算本周的星期二
$tuesday = $day - ($now - 2) * 86400;
$data = [];
//半月内每周二 四 六的时间, 分别间隔 1 2 4 7 9 11 天
$week = [0 => 1, 1 => 2, 3 => 4, 4 => 7, 5 => 9, 6 => 11];
foreach ($week as $key => $value) {
//指定每周二 四 六 10点钟
if ($key == 0) {
$time = $tuesday + 3600 * 10;
} else {
$time = $tuesday + 86400 * $value + 3600 * 10;
}
$week = date("Y-m-d H:i:s", $time);
$data[$time] = $week;
}
return $data;
}