Microtime function
Description: Returns the current UNIX timestamp and number of microseconds
Syntax: Mixed microtime ([bool $get _as_float])
Direct output echo microtime ();//Get the following: 0.26672100 1585622985 Front is the current microsecond number, followed by the normal timestamp, separated by a space in the middle//If with parameters (Boolean parameter) echo Microtime (True) ;//Output result: 1585623020.7408 The number of microseconds that have just been shown in the form of floating-point numbers after the original timestamp
Floating-point numbers are too long for formatting operations
Round ($float, 3) means reserved to three digits after the decimal point
uniqid function
Description: Generate a unique ID
Syntax: String uniqid ([String $prefix = "" [, bool $more _entropy = false]) is an optional parameter
The first parameter is a prefix
Echo uniqid ("haha"); // The result is haha ... (randomly generated later)
But we don't have the same prefix that doesn't make sense, so we can
Uniqid (Microtime ());
Uniqid (Microtime (). Mt_rand ());
This time we will find that it will have time stamp and random number + random ID, but the length is not fixed
At this time we can use UUID (Generate unique ID)
The UUID 8-4-4-4-12 is exactly 32 bits (MD5 is 32 bits)
echo MD5 (Uniqid (Microtime (). Mt_rand ())), ' <br> ';
This produces a form of UUID, so that the file name even in a distributed environment is unique, some sites will also use the MAC address of the network card, this is the only;
PHP gets timestamps and microseconds and generates unique IDs