Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/271.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php cal_days_in_month()函数不起作用_Php - Fatal编程技术网

Php cal_days_in_month()函数不起作用

Php cal_days_in_month()函数不起作用,php,Php,这个cal\u days\u in\u month()在PHP版本5.2.11中不起作用 $days_in_month = cal_days_in_month(0,$month,$year); 因为语法是: $days_in_month = cal_days_in_month(CALENDAR,$month,$year); 像这样: $days = cal_days_in_month(CAL_GREGORIAN, 2, 2012); 您需要提供日历: int cal_days_in_mon

这个
cal\u days\u in\u month()
在PHP版本5.2.11中不起作用

$days_in_month = cal_days_in_month(0,$month,$year);
因为语法是:

$days_in_month = cal_days_in_month(CALENDAR,$month,$year);
像这样:

$days = cal_days_in_month(CAL_GREGORIAN, 2, 2012);

您需要提供日历:

int cal_days_in_month ( int $calendar , int $month , int $year )
比如:

您可能会将其与
calu info([int$calendar=-1])混淆。
它采用日历的表示形式:

0 or CAL_GREGORIAN - Gregorian Calendar
1 or CAL_JULIAN - Julian Calendar
2 or CAL_JEWISH - Jewish Calendar
3 or CAL_FRENCH - French Revolutionary Calendar
试一试

我在互联网上发现,它需要PHP来编译日历支持


“使用“-enable calendar”选项重新编译php。”

在docker容器中存在相同问题(基于image
php:7.4-apache-buster
),在
Dockerfile
中添加以下行解决了问题:


运行docker php ext安装日历

echo$month;echo$年返回报告。不确定,但尝试将0更改为
CAL_GREGORIAN
,同时查看您的输入是否正确。什么不正常?结果为空,错误消息..?@Raj Kumar:默认情况下,我们都知道该函数可以工作。但是,对于您的情况,我们不知道
$month
$year
是什么,因此我们无法帮助您。请尝试更具体地回答您的问题。什么不起作用?输入是什么?输出是什么?预期的输出是什么?非常感谢这个日期('t',mktime(0,0,0,$month,1,$year));我得到了我的答案这是我找到的最好的答案(以防有人不想重新编译php)我们是否需要移动到任何目录以及“使用”--启用日历“选项重新编译php”的命令。我是否需要下载任何东西。。从什么地方来的?我走过来,不知道该怎么走。亲爱的,我怎么能不想到这一点。
0 or CAL_GREGORIAN - Gregorian Calendar
1 or CAL_JULIAN - Julian Calendar
2 or CAL_JEWISH - Jewish Calendar
3 or CAL_FRENCH - French Revolutionary Calendar
date('t', mktime(0, 0, 0, $month, 1, $year));