Correctly implement PHP to generate a unique identifier. Today, we will introduce in detail the sample code for generating a unique identifier in PHP :? Generate the unique identifier sha1 () function. the security hash algorithm (SHA1) functioncreate_uniq is related
Sample code for generating a unique identifier in PHP:
- <?
- // Generate a unique identifier
- // Sha1 () function, "security hash algorithm (SHA1 )"
- Function create_unique (){
- $ Data = $ _ SERVER ['http _ USER_AGENT ']. $ _ SERVER ['remote _ ADDR']
- . Time (). rand ();
- Return sha1 ($ data );
- // Return md5 (time (). $ data );
- // Return $ data;
- }
- ?>
Function description and example for generating unique identifiers in PHP
- < ?
- $newhash = create_unique();
- echo $newhash;
- ?>
-
Example code for generating unique identifiers in login PHP :? // Generate the unique identifier // sha1 () function, security hash algorithm (SHA1) functioncreate_uniq...