我们今天要为大家详细介绍的是有关
PHP生成唯一标识符代码示例:
- ?
- //生成唯一标识符
- //sha1()函数, "安全散列算法(SHA1)"
- function create_unique() {
-
$data = $_SERVER['HTTP_USER_AGENT'] . $_SERVER['REMOTE_ADDR']
- .time() . rand();
- return sha1($data);
- //return md5(time().$data);
- //return $data;
- }
-
?>
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