PHP/MySQL - Best way to create unique random string?

后端 未结 10 2119
囚心锁ツ
囚心锁ツ 2020-12-15 04:20

How do I create a random unique string in MySQL?

when I need to create a random string in PHP I use this function:

public function generateString($le         


        
10条回答
  •  自闭症患者
    2020-12-15 04:59

    Why not just use the built-in functions for generating unique identifiers? You wouldn't have to worry about duplicates that way.

    Both PHP and MySQL have their own.

    PHP: uniqid()

    MySQL: UUID()

提交回复
热议问题