php 随机显示据今天30天内的任意一天

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();
原文地址:https://www.cnblogs.com/php411161555/p/3907602.html