search
Homephp教程php手册如何正确实现PHP生成唯一标识符

如何正确实现PHP生成唯一标识符

Jun 13, 2016 am 11:10 AM
phpforintroduceonlyhowaccomplishusyesidentifiercorrectgenerateofwantdetailed

我们今天要为大家详细介绍的是有关

PHP生成唯一标识符代码示例:

  1.  ?  
  2. //生成唯一标识符   
  3. //sha1()函数, "安全散列算法(SHA1)"   
  4. function create_unique() {   
  5. $data = $_SERVER['HTTP_USER_AGENT'] . $_SERVER['REMOTE_ADDR']   
  6. .time() . rand();   
  7. return sha1($data);   
  8. //return md5(time().$data);   
  9. //return $data;   
  10. }  
  11. ?>  

PHP生成唯一标识符函数描述及例子

<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>
</li>
<li class="alt"><span> </span></li>
</ol>


Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.