Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当我们有这种格式的数字时,PHP 有没有办法用法语打印月份名称和52013年份42013?
52013
42013
我努力了:
$month = 42013; $monthNr = substr($month, -5, 1); $timestamp = mktime(0, 0, 0, $monthNr, 1); $monthName = date('M', $timestamp ); echo $monthName;
但结果是四月
我想得到Avril 2013
Avril
2013
你可以做一个简单的月份名称数组
$months = array(1 => 'Janvier', 2 => 'Février'...);
然后只需查找月份值
$monthName = $months[date('n', $timestamp )];
或基于评论建议(这是基于链接问题中的答案)
setlocale(LC_ALL, 'fr_FR'); echo strftime('%B', $timestamp);