【问题标题】:Generating sequence of unique strings with the length of 7 or 8 characters生成长度为 7 或 8 个字符的唯一字符串序列
【发布时间】:2010-10-01 23:15:17
【问题描述】:

用“JES9-99S”之类的好字符串而不是文件号 3992 来跟踪用户文件真是太好了

假设我们最多有 10MIL 个文件,我需要一个可以生成长度为 7 或 8 个字符的唯一 id 的 uniqid 生成器算法。

【问题讨论】:

  • 出于好奇:为什么会有“7 或 8”的限制?数字有什么问题(除了 ascii 中每个字节的有限范围)?

标签: php unique


【解决方案1】:

您可以修改它以满足您的需要:

【讨论】:

  • You may want to remove vouwels (a, e, o, u, i) from $index as to avoid combinations that result in: 'penis' or other dirty words that could get your customers upset.lol
猜你喜欢
  • 1970-01-01
  • 2017-01-14
  • 2011-02-17
  • 2011-08-14
  • 2012-03-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-05-24
相关资源
最近更新 更多