What is the format of the UUID string I think a lot of friends do not know, but you have already come to know what is the UUID, let's look at how to generate a UUID string.
A UUID is a number generated on a machine that guarantees that all machines in the same time and space are unique. Typically the platform provides the API to generate the UUID. The UUID is based on the standards established by the Open Software Foundation (OSF), using Ethernet card addresses, nanosecond-seconds, chip ID codes, and many possible numbers. A combination of the following: the current date and time (the first part of the UUID is related to the time, if you generate a UUID after a few seconds, the first part is different, the rest is the same), the clock sequence, the globally unique IEEE Machine identification number (if there is a network card, from the network card, No network cards are available in other ways, the only drawback to the UUID is that the resulting string will be longer. The most common use of UUID for this standard is the GUID of Microsoft (Globals Unique Identifiers).
In ColdFusion, the UUID can be easily generated using the Createuuid () function in the form of: Xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxxxxxx (8-4-4-16), where each x is 0-9 or a-f A hexadecimal number within the range. The standard UUID format is: xxxxxxxx-xxxx-xxxx-xxxxxx-xxxxxxxxxx (8-4-4-4-12)
The code is as follows |
Copy Code |
function guid () { if (function_exists (' Com_create_guid ')) { return Com_create_guid (); }else{ Mt_srand (Double) microtime () *10000); Optional for PHP 4.2.0 and up. $charid = Strtoupper (MD5 (Uniqid (rand (), true)); $hyphen = Chr (45); // "-" $uuid = Chr (123) // "{" . substr ($charid, 0, 8). $hyphen . substr ($charid, 8, 4). $hyphen . substr ($charid, 4). $hyphen . substr ($charid, 4). $hyphen . substr ($charid, 20,12) . chr (125); // "}" return $uuid; } } ?> |
http://www.bkjia.com/PHPjc/632819.html www.bkjia.com true http://www.bkjia.com/PHPjc/632819.html techarticle what is the format of the UUID string I think a lot of friends do not know, but you have already come to know what is the UUID, let's look at how to generate a UUID string. The UUID refers to ...