什么是 guid?
全球唯一标识符 (guid) 是一个字母数字标识符,用于指示产品的唯一性安装。在许多流行软件应用程序(例如 web 浏览器和媒体播放器)中,都使用 guid。
guid 的格式为“xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx”,其中每个 x 是 0-9 或 a-f 范围内的一个十六进制的数字。例如:6f9619ff-8b86-d011-b42d-00c04fc964ff 即为有效的 guid 值。
为什么要用guid?
世界上的任何两台计算机都不会生成重复的 guid 值。guid 主要用于在拥有多个节点、多台计算机的网络或系统中,分配必须具有唯一性的标识符。在 windows 平台上,guid 应用非常广泛:注册表、类及接口标识、数据库、甚至自动生成的机器名、目录名等。
asp下生成guid的代码
dim objtypelib
set ōbjtypelib = createobject(scrīptlet.typelib)
response.write objtypelib.guid
%>
php下生成guid要用到class .
guid.class.guid
class system
{
function currenttimemillis()
{
list($usec, $sec) = explode( ,microtime());
return $sec.substr($usec, 2, 3);
}
}
class netaddress
{
var $name = ''localhost'';
var $ip = ''127.0.0.1'';
function getlocalhost() // static
{
$address = new netaddress();
$address->name = $_env[computername];
$address->ip = $_server[server_addr];
return $address;
}
function tostring()
{
return strtolower($this->name.''/''.$this->ip);
}
}
class random
{
functi