Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
这没关系,但会导致重复,如何分配机器日期和时间并应用于该六位数唯一?
不工作:sprintf("%0d", mt_rand(1, 999999));
sprintf("%0d", mt_rand(1, 999999));
试试这个:
sprintf("%06d", mt_rand(1, 999999));
同样,看看:
uniqid();
那也可以用...
http://php.net/manual/en/function.uniqid.php