如何使用PHP获取本月的最后一天?
<?php
echo date('?-?-?');
?>
Run Code Online (Sandbox Code Playgroud)
May*_*tel 10
<?php
$day=new DateTime('last day of this month');
echo $day->format('M jS');
?>
Run Code Online (Sandbox Code Playgroud)
试试这个
$day=date('Y-m-t'); // gives last day of current month
Run Code Online (Sandbox Code Playgroud)
要么
$d = new DateTime( '2013-05-03' );
echo $d->format( 'Y-m-t' );
Run Code Online (Sandbox Code Playgroud)