PHP cal_info() 函数

cal_info()

返回 PHP Calendar 参考手册


返回格利高里历法的信息:

<?php
print_r(cal_info(0));
?>

执行结果

Array (
    [months] => Array ( 
        [1] => January 
        [2] => February 
        [3] => March 
        [4] => April 
        [5] => May 
        [6] => June 
        [7] => July 
        [8] => August 
        [9] => September 
        [10] => October
        [11] => November 
        [12] => December 
    )
    [abbrevmonths] => Array ( 
        [1] => Jan 
        [2] => Feb 
        [3] => Mar 
        [4] => Apr
        [5] => May
        [6] => Jun
        [7] => Jul 
        [8] => Aug
        [9] => Sep 
        [10] => Oct 
        [11] => Nov
        [12] => Dec
    ) 
    [maxdaysinmonth] => 31
    [calname] => Gregorian
    [calsymbol] => CAL_GREGORIAN 
)

定义和用法

cal_info() 函数返回有关指定历法的信息。


语法

cal_info(calendar);

参数说明

calendar : 可选。规定一个表示要使用的历法的数字。可以使用下面这些常量:

  • 0 = CAL_GREGORIAN
  • 1 = CAL_JULIAN
  • 2 = CAL_JEWISH
  • 3 = CAL_FRENCH

提示:如果 calendar 参数被省略,cal_info() 返回有关所有历法的信息。


技术细节

返回值: 返回包含如下日历元素的数组:
  • calname
  • calsymbol
  • month
  • abbrevmonth
  • maxdaysinmonth
PHP 版本: 4.1+
更新日志: 在 PHP 5.0 中,calendar 参数是可选的。

返回 PHP Calendar 参考手册

查看笔记

扫码一下
查看教程更方便