PHP URL Shortening Algorithm

后端 未结 7 891
说谎
说谎 2020-12-28 09:22

Could anyone recommend a preferred algorithm to use for URL shortening? I\'m coding using PHP. Initially I thought about writing something that would start at a character su

7条回答
  •  一向
    一向 (楼主)
    2020-12-28 09:42

    The native PHP base_convert() works well for small ranges of numbers, but if you really need to encode large values, consider using something like the implementation provided here which will work to base 64 and beyond if you simply provide more legal characters for the encoding.

    http://af-design.com/blog/2010/08/10/working-with-big-integers-in-php/

提交回复
热议问题