php - Create a unique random token string in Yii for users table -
i working on yii app requires 'users' table have column 'token' need unique random string based upon user in table (eg there never same token twice).
can give me tips on doing this, or there yii component/extension/generator setup this.
also - optimised db column type this?
i suggest use hash, produces long string , use unique string hashed:
sha512($username.time().rand(1000, 9999));
Comments
Post a Comment