如何使用PHP_intl显示月份名称?

Ami*_*ari 4 php datetime

我一直在拿号码而不是月份名字.我需要得到像七月这样的月份名称.

$formatter = new \IntlDateFormatter(
    "fa_IR@calendar=persian",
    \IntlDateFormatter::FULL,
    \IntlDateFormatter::FULL,
    'Asia/Tehran',
    \IntlDateFormatter::TRADITIONAL
);
$time = new \DateTime();
$formatter->setPattern('yyyy mm dd');
$formatter->format($time)
Run Code Online (Sandbox Code Playgroud)

hon*_*hah 5

你可以使用MMMM.
所有可用的模式都在此链接上

$formatter = new \IntlDateFormatter(
    "fa_IR@calendar=persian",
    \IntlDateFormatter::FULL,
    \IntlDateFormatter::FULL,
    'Asia/Tehran',
    \IntlDateFormatter::TRADITIONAL
);
$time = new \DateTime();
$formatter->setPattern('yyyy MMMM dd');
$formatter->format($time)
Run Code Online (Sandbox Code Playgroud)

这个问题与相同