Making a short URL similar to TinyURL.com

前端 未结 5 1395
攒了一身酷
攒了一身酷 2020-12-14 04:39

I\'m building a new web app that has a requirement to generate an internal short URL to be used in the future for users to easily get back to a specific page which has a ver

5条回答
  •  感情败类
    2020-12-14 05:24

    My initial thoughts are to store a number in a database and output it in a HEXADECIMAL value to keep it shorter than an integer.

    What is the point of keeping something shorter than an integer?
    So you want to have URL like: http://here.there/12D687 instead of http://here.there/1234567?

    If you'll ask me which one is easier for me I'll tell the latter one.
    But honestly I do not see the point in my example as both are pretty much the same.

    Is there an easy way to generate something similar what TinyURL does?

    Yes. Ask the user to provide it.
    If it is not possible just use the plain integer id. What can be easier...

提交回复
热议问题