php输出指定范围的所有日期函数,网上别人封装的,道理很简单,获取最大值和最小值的时间戳,然后+1day即可,测试有效
function periodDate($startDate, $endDate)
{
$startTime = strtotime($startDate);
$endTime = strtotime($endDate);
$arr = [];
while ($startTime <= $endTime)
{
$arr[] = date('Y-m-d', $startTime);
$startTime = strtotime('+1 day', $startTime);
}
return $arr;
}调用方法:
//获取2021年全年的日期
$allData = periodDate('2021-01-01', '2021-12-31');输出内容:
array(365) {
[0]=>
string(10) "2021-01-01"
[1]=>
string(10) "2021-01-02"
[2]=>
string(10) "2021-01-03"
[3]=>
string(10) "2021-01-04"
[4]=>
string(10) "2021-01-05"
....
.... Redis提供了发布订阅功能,可以用于消息的传输,Redis的发布订阅机制包括三个部分,发布者(publisher),订阅者(subscriber)和频道(channel)。 发布者和订阅者都是Redis客户端,Channel则为Redis服务器端,发布者将消息发送到某个的频道,订阅了这个...
<?php $member = new class { public function getInfo() { ...
<?php /** * @throws Exception */ function curl() { throw new \Exception('err...
elasticsearch的操作都是基于http协议的,已经有现成的php类库,composer安装即可。{ "require": { &...
PHP简单定时器可以通过pcntl_signal创建闹钟信号来实现。但是缺点很明显,性能一般,要自己实现守护进程,不支持毫秒级定时器,单进程不支持多个闹钟信号,不能跨平台运行event扩展支持的事件多,性能高。<?php //创建event配置.[空配置] $eventConfig ...
【一】.基本用法首先看看官方对send方法的解释:Sets the return value of the yield expression and resumes the generato...