php将时间戳转换为大写日期
public function dateTimeToUpper($stamp, $type)
{
$year = str_split(date('Y', $stamp));
$month = intval(date('m', $stamp));
$chars = array(
0 => ['〇', '零'],
1 => ['一', '壹'],
2 => ['二', '贰'],
3 => ['三', '叁'],
4 => ['四', '肆'],
5 => ['五', '伍'],
6 => ['六', '陆'],
7 => ['七', '柒'],
8 => ['八', '捌'],
9 => ['九', '玖'],
10 => ['十', '拾'],
11 => ['十一', '拾壹'],
12 => ['十二', '拾贰'],
13 => ['十三', '拾叁'],
14 => ['十四', '拾肆'],
15 => ['十五', '拾伍'],
16 => ['十六', '拾陆'],
17 => ['十七', '拾柒'],
18 => ['十八', '拾捌'],
19 => ['十九', '拾玖'],
20 => ['二十', '贰拾'],
21 => ['二十一', '贰拾壹'],
22 => ['二十二', '贰拾贰'],
23 => ['二十三', '贰拾叁'],
24 => ['二十四', '贰拾肆'],
25 => ['二十五', '贰拾伍'],
26 => ['二十六', '贰拾陆'],
27 => ['二十七', '贰拾柒'],
28 => ['二十八', '贰拾捌'],
29 => ['二十九', '贰拾玖'],
30 => ['三十', '叁拾'],
31 => ['三十一', '叁拾壹'],
);
$date = '';
foreach ($year as $y) {
$date .= $chars[$y][$type];
}
$date .= '年';
$date .= $chars[$month][$type] . '月';
return $date;
}
echo $this->dateTimeToUpper(time(), 0);