Пример #1
0
            $server_name = '--';
        }
        $server_name = str_replace(' ', '-', $server_name);
        return strtolower(trim($server_name));
    }
    public static function fast_uuid($suffix_len = 3)
    {
        //! 计算种子数的开始时间
        static $being_timestamp = 1421833799;
        $time = explode(' ', microtime());
        $id = $time[1] - $being_timestamp . sprintf('%06u', substr($time[0], 2, 6));
        if ($suffix_len > 0) {
            $id .= substr(sprintf('%010u', mt_rand()), 0, $suffix_len);
        }
        return $id;
    }
    public static function identify($x)
    {
        static $mask = '0123456789abcdefghijklmnopqrstuvwxyz';
        $x = sprintf("%u", crc32($x));
        $m = '';
        while ($x > 0) {
            $s = $x % 36;
            $m .= $mask[$s];
            $x = floor($x / 36);
        }
        return $m;
    }
}
Env::detect();