easywechat4.x升级到6.x
This commit is contained in:
@@ -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
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user