海滨擎蟹

php 生成唯一标识

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;
}

当前页面是本站的「Google AMP」版。查看和发表评论请点击:完整版 »