What would be an efficient way of generating Plancast-style short URLs?
Plancast generate short URLs like http://plancast.com/p/3e9c
for event pages.
URL hashes don't seem sequential, but they're probably not completely random either.
Here are a few ones for example: 3sro
, 3fsz
, 3k4f
, 382n
, 3c5x
, etc.
What would be an efficient way of deterministically generating such hashes from PHP and MySQL, with the appearance of being randomly ge开发者_运维问答nerated?
We set up those URLs so that last piece is simply the ID of the event in our database converted to base 36. They only appear random because they are in that base, but in fact, they are incrementing one at a time as we get new events in the system.
精彩评论