自动递增一串数字和字母 [英] auto increment with a string of numbers and letters

查看:136
本文介绍了自动递增一串数字和字母的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在我正在使用自动增量来标识我的网站中的资源.

Right now im using auto increment to identify resources in my website.

问题是我不希望用户知道有多少资源.

The problem is i dont want the users to know how many resources there are.

我该如何代替我可以使用的某种结构化的字母和数字(例如6位数字)的随机"组合来代替(或除之以外)自动递增的主键号.

How could i instead use some kind of structured "random" combination of letters and numbers (say 6 digits) that i could use instead of (or in addition to) the auto incrementing primary key numbers.

基本上我希望用户看到

website.com/page.php?4jnd32

代替

website.com/page.php?13

我什至不知道这种做法叫什么,这妨碍了我寻找答案的能力

I dont even know what this practice is called which hampers my ability to search for an answer

推荐答案

如果您确实要这样做,请创建一个新字段(例如:fake_id),然后使用php的 uniqid 函数.

If you really want this, create a new field (e.g: fake_id) then use php's uniqid function.

这篇关于自动递增一串数字和字母的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆