~~~
/**
* get_some_day 获取n天前0点的时间戳
* @param int $some n天
* @param null $day 当前时间
* @return int|null
* @author:xjw129xjt(肖骏涛) xjt@ourstu.com
*/
function get_some_day($some = 30, $day = null){
$time = $day ? $day : time();
$some_day = $time - 60 * 60 * 24 * $some;
$btime = date('Y-m-d' . ' 00:00:00', $some_day);
$some_day = strtotime($btime);
return $some_day;
}
~~~
var_dump(get_some_day(1,time()));
**输出如下:**
> int(1461772800)
获取的时间戳为当前时间戳的前一天凌晨