function randomDate() { //echo date( "Y-m-d H:m:s", $newtime); //echo date("Y-m-d H:m:s", strtotime("+2 week 1 days 7 hours 5 seconds")); $begin = strtotime("now"); $end = strtotime("+1 Month"); $timestamp = rand($begin, $end); return date("Y-m-d H:i:s", $timestamp); } echo randomDate();
php 随机显示据今天30天内的任意一天
时间: 2024-10-08 21:30:35