1

重複の可能性:
文字列が UNIX タイムスタンプかどうかを確認する

PHPで正規表現を使用してUNIX時間を検証する必要があります。例:

<?php
is_unix( $unix )
{
    if( preg_match( '/([0-9]+)/' , $unix ) )
    {
        return true;
    }
    return false;
}
?>

ありがとう ;)

4

1 に答える 1

3

どうですか:

function is_unix($t) {
    if ( is_numeric($t) && 0<$t && $t<strtotime("some date in the future that you don't expect the value to exceed, but before year 2038") ) {
        return true;
    }else{
        return false;
}
于 2012-05-23T16:24:37.010 に答える