easywechat4.x升级到6.x

This commit is contained in:
Dev
2026-09-21 14:57:50 +08:00
parent 39882c6cf2
commit 5f4c8147ca
11 changed files with 263 additions and 185 deletions
+19 -1
View File
@@ -761,12 +761,30 @@ EOD;
$months = [];
foreach (range(1, 12) as $month) {
$months[$month] = strftime($format, mktime(0, 0, 0, $month, 1));
$months[$month] = date(self::strftimeToDate($format), mktime(0, 0, 0, $month, 1));
}
return $this->select($name, $months, $selected, $options);
}
/**
* 将 strftime 格式符转换为 date() 格式符
* (strftime 自 PHP 8.1 起废弃)
* @param string $format strftime 格式串
* @return string
*/
protected static function strftimeToDate($format)
{
$map = [
'%d' => 'd', '%e' => 'j', '%j' => 'z', '%m' => 'm',
'%H' => 'H', '%I' => 'h', '%M' => 'i', '%S' => 's',
'%y' => 'y', '%Y' => 'Y', '%%' => '%',
'%a' => 'D', '%A' => 'l', '%b' => 'M', '%B' => 'F', '%h' => 'M',
'%p' => 'A', '%T' => 'H:i:s', '%R' => 'H:i',
];
return strtr($format, $map);
}
/**
* 根据传递的值生成option
*