PHP: How to generate a random, unique, alphanumeric string for use in a secret link?

后端 未结 28 2250
隐瞒了意图╮
隐瞒了意图╮ 2020-11-21 22:20

How would it be possible to generate a random, unique string using numbers and letters for use in a verify link? Like when you create an account on a website, and it sends y

28条回答
  •  情话喂你
    2020-11-21 22:58

    I like to use hash keys when dealing verification links. I would recommend using the microtime and hashing that using MD5 since there should be no reason why the keys should be the same since it hashes based off of the microtime.

    1. $key = md5(rand());
    2. $key = md5(microtime());

提交回复
热议问题