Home > Backend Development > PHP Tutorial > 如何实现sn码的生成

如何实现sn码的生成

WBOY
Release: 2016-06-23 14:27:06
Original
1647 people have browsed it

怎样实现啊,最好提供代码,不行的话说个思路也行,一点头绪也没有啊............


回复讨论(解决方案)

唯一序列码的生成有很多实现方式。

比如一种方式:user id+current timestamp就可以是一种。用一般而言在数据库中唯一的用户登录id加上生成该记录的时间戳(可以考虑精确到毫秒)就是可行的。具体还要看你的用例。

<?phpecho uniqid() .rand(10000,99999);
Copy after login


不要问我是谁,我是雷锋。

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template