php 生成唯一标识

2018-03-01T17:58:00
function uuid( $more = true, $admin = false )
{
    if ( $more )
    {
        return uniqid( md5( mt_rand() ), true );
    }
    else
    {
        if ( $admin ) return uniqid( "zzz", false );
        return uniqid( create_guid_section( 3 ), false );
    }
}

function create_guid_section( $characters )
{
    $return = "";
    for ( $i = 0; $i < $characters; $i++ )
    {
        $return .= dechex( mt_rand( 0, 15 ) );
    }
    return $return;
}
当前页面是本站的「Baidu MIP」版。发表评论请点击:完整版 »