PHP日期实际年份

Wou*_*ter 3 php

我有这个:

$startdate = date("Y-m-d", strtotime('2015-' . $startmonth . '-01'));
Run Code Online (Sandbox Code Playgroud)

但是,如何填补当年,我如何获得当年?

rcc*_*ros 5

您可以使用 date('Y')

$startdate = date("Y-m-d", strtotime(date('Y') . '-' . $startmonth . '-01'));
Run Code Online (Sandbox Code Playgroud)