<?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; } //测试方法 $newhash = create_unique(); echo $newhash; //bc4941159eef2d06ad98df9c8ae00fa3a07fe7bc ?>