PHP code example of youhujun / plunar
1. Go to this page and download the library: Download youhujun/plunar library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
youhujun / plunar example snippets
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
]
]