如何在现有脚本中获得PHP中的法语月份名称?

如何在现有脚本中获得PHP中的法语月份名称?,php,date,french,Php,Date,French,我使用下面的代码创建一个从本月开始的未来12个月的选择下拉列表: $year=date("Y"); //Current Month $month = date('m'); $dateObj = DateTime::createFromFormat('!m', $month); $month0 = $dateObj->format('F'); $monthHTML .= "<option value='$month/$year'>$month0 $year</opti

我使用下面的代码创建一个从本月开始的未来12个月的选择下拉列表:

$year=date("Y");
//Current Month
$month = date('m');
$dateObj   = DateTime::createFromFormat('!m', $month);
$month0 = $dateObj->format('F'); 
$monthHTML .= "<option value='$month/$year'>$month0 $year</option>";
//next 11 months
for ($i=1; $i<=11; $i++) {
    $month = date('m', strtotime('first day of +'.$i.' month'));
        if($month==01) {
            $year++;
        }
    $dateObj   = DateTime::createFromFormat('!m', $month);
    ${"month".$i} = $dateObj->format('F'); 
    $monthHTML .= "<option value='$month/$year'>".${"month".$i}." $year</option>";
}
将“strotime”改为“strftime”,但这会消除这两个错误。我做错了什么

Warning: date() expects parameter 2 to be long, string given in /home/mysite/public_html/add.php on line 31

Fatal error: Call to a member function format() on a non-object in /home/mysite/public_html/add.php on line 36

使用
setlocale()
strftime()


使用
setlocale()
strftime()


<select id="default-calendar-month" name="default-month">
            <option value='01/2018'>Janvier 2018</option><option value='02/2018'>Fevrier 2018</option>
setlocale(LC_TIME, "fr_FR");
Warning: date() expects parameter 2 to be long, string given in /home/mysite/public_html/add.php on line 31

Fatal error: Call to a member function format() on a non-object in /home/mysite/public_html/add.php on line 36
<?php
setlocale(LC_ALL, 'fr_FR');

echo strftime("%A");
?>
<? 
    setlocale (LC_TIME, 'fr_FR.utf8','fra'); 
    echo (strftime("%A %d %B")); 

?>
$date = str_replace(
    array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'),
    array('Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'),
   $date
);