基于日期和时间的最短唯一ID


Shortest unique ID based on date and time?

可以用PHP创建但不使用数据库的最短唯一ID是什么?我猜是基于日期+时间(24小时时间格式?)的东西,但它能有多短?

对于PHP内置解决方案,您可以查看uniqid (http://php.net/manual/en/function.uniqid.php)。

$id = uniqid('',true);

或者您可以创建一个UUID。PHP函数生成v4 UUID