PHP检查是否是时间戳

/**
 * 检测是否是时间戳
 */
public static function checkTimestamp($timestamp) {
    if(!is_int($timestamp)) {
        return false;
    }

    if(strtotime(date('Y-m-d H:i:s',$timestamp)) === $timestamp) {
        return true;
    } else {
        return false;
    }
}
posted @ 2021-06-01 16:13  TBHacker  阅读(1040)  评论(0)    收藏  举报