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"
....
.... (1).前端文件:<form action="upload.php" method="post" enctype="multipart/form-data"> &...
(1).config.php 配置文件<?php /** * RabbitMQ_Config */ $config = [ 'host' => ...
最近在公司开发一个新的项目假设项目域名是a.com,需要接入b.com的单点登陆系统。(1).首先我们会在a.com的登陆页面用iframe引入b.com来显示登陆界面,实际上登陆验证操作都是在b.com上面(2).当b.com验证通过,会在前端ajax请求a.com的回调地址,这个回调地址目的就是...
今天帮朋友查询wordpress执行超级慢的原因,特此记录开启fpm的慢日志,记录执行超过30秒的脚本request_slowlog_timeout = 30 slowlog = var/log/slow.log查看日志[23-May-2019 17...
使用openssl扩展对应替换mcrypt的函数,(比较麻烦,但是openssl是未来趋势)在新版php中编译mcrypt扩展使用一个纯php代码实现的mcrypt扩展库,git地址为https://github.com/phpseclib/mcrypt_compat,每个mcrypt的方法都已经实...
最近在项目中处理一个关于商品数据重复需要删除多余的商品记录,但是删除一条商品必然要把关联的其他表商品的id和其他商品信息更换为正确的,删除一个商品记录,同时要去修改100多张表的关联商品数据,在项目中引用了tp orm 1.2版本,由于项目是php5.6版本,没法使用最新orm,在代码中每处理1个商...