What we want to introduce to you in detail today is the code example of
PHP generating unique identifier:
- < ?
- //Generate unique identifier
- //sha1() function, "Secure 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;
- }
- ?>
PHP generate unique identifier function description and examples
1 2 3 4 | <ol class = "dp-xml" >
<li class = "alt" ><span><span class = "tag" ><</span><span> ? </span></span></li><li><span>$</span><span class = "attribute" >newhash</span><span> = </span><span class = "attribute-value" >create_unique</span><span>(); </span></li><li class = "alt" ><span> echo $newhash ; </span></li><li><span class = "tag" >?></span><span> </span></span></li>
<li class = "alt" ><span> </span></li>
</ol>
|
Copy after login
http://www.bkjia.com/PHPjc/446019.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/446019.htmlTechArticleWhat we want to introduce to you in detail today is the code example for generating unique identifiers in PHP: ? //Generate unique identifiers Symbol //sha1() function, secure hash algorithm (SHA1) functioncreate_uniq...