{site_name}

{site_name}

🌜 搜索

cal_info()是PHP中的一个函数,用于检索日历信息(calendar information)

php 𝄐 0
php菜鸟教程,php参考文献,php操作数组的函数,Php 采集京东评论 标签,Php case 下划线,Php 操作文件做图片存储管理的代码
cal_info()是PHP中的一个函数,用于检索日历信息(calendar information)。该函数返回一个数组,其中包含有关可用于给定日历类型的月份和星期几的详细信息。

以下是使用cal_info()函数的示例:

php
// 获取所有支持的日历类型
$calendars = cal_info(0);
print_r($calendars);

// 获取波斯日历的月份和星期几信息
$persian_calendar_info = cal_info(CAL_PERSIAN);
print_r($persian_calendar_info);


输出结果:


Array
(
[CAL_GREGORIAN] => Array
(
[months] => Array
(
[1] => January
[2] => February
...
)
[abbrevmonths] => Array
(
[1] => Jan
[2] => Feb
...
)
[maxdaysinmonth] => Array
(
[1] => 31
[2] => 28
...
)
[firstdayofweek] => 0
[monthname] =>
[abbrevdayname] => Array
(
[0] => Sun
[1] => Mon
...
)
[dayname] => Array
(
[0] => Sunday
[1] => Monday
...
)
)
)

Array
(
[months] => Array
(
[1] => Farvardin
[2] => Ordibehesht
...
)
[abbrevmonths] => Array
(
[1] => Far
[2] => Ord
...
)
[maxdaysinmonth] => Array
(
[1] => 31
[2] => 31
...
)
[firstdayofweek] => 6
[monthname] =>
[abbrevdayname] => Array
(
[0] => Shanbe
[1] => Yekshanbe
...
)
[dayname] => Array
(
[0] => Saturday
[1] => Sunday
...
)
)


在上面的示例中,第一个cal_info(0)调用返回所有支持的日历类型的数组。第二个cal_info(CAL_PERSIAN)调用返回波斯日历的月份和星期几信息数组。