Package Data | |
---|---|
Maintainer Username: | guojikai |
Maintainer Contact: | guojikai@gmail.com (guojikai) |
Package Create Date: | 2016-01-11 |
Package Last Update: | 2017-05-30 |
Home Page: | |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-12-19 03:20:35 |
Package Statistics | |
---|---|
Total Downloads: | 531 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 23 |
Total Watchers: | 2 |
Total Forks: | 11 |
Total Open Issues: | 1 |
一个PHP版中国阴历转换工具,用于将阳历日期转换为中国阴历日期。
使用 Composer 安装:
composer require guojikai/plunar
在入口文件引入 Composer 启动脚本: (eg. index.php)
require 'vendor/autoload.php';
<?php
use Plunar\Plunar;
use Plunar\PlunarException;
try {
//支持字符串输入形式 Plunar::solarToLunar('1984-09-22');
$lunar_array = Plunar::solarToLunar(1984, 9, 22);
} catch (PlunarException $e) {
echo $e->getMessage();
exit;
}
var_dump($lunar_array);
?>
输出:
array:7 [
0 => "一九八四" //阴历年
1 => "八月" //阴历月
2 => "廿七" //阴历日
3 => "甲子" //天干地支
4 => "鼠" //生肖
5 => "闰十月" //闰月
6 => array:3 [ //阴历日期对应数字
0 => 1984
1 => 8
2 => 27
]
]