如果您没有外壳访问服务器,则此解决方案可能会有所帮助。
如果您具有外壳访问权限,那么本杰明·塞勒(BenjaminSeiller)的答案是最好的!
由于我没有其他可能性(外壳),因此我使用IntlDateFormatter类找到了仅使用PHP的解决方案。
<?php// Example vars$month = '6';$year = '2014';$fmt = new IntlDateFormatter('de_DE', IntlDateFormatter::FULL, IntlDateFormatter::FULL, 'Europe/Berlin', IntlDateFormatter::GREGORIAN);$lastMonth = mktime(0, 0, 0, $month -1, 1, $year);$showLastMonth = $fmt->format($lastMonth);echo $showLastMonth;


