# shortURL **Repository Path**: lemon_lyue/shortURL ## Basic Information - **Project Name**: shortURL - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-04-18 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ### Laravel实现短链接 #### 一、composer安装项目依赖 `composer install` #### 二、数据库存储链接 表结构: | 字段名 | 类型 | 长度 | | ------------- |:-------------| -----:| | id | int | 11 | | short_url | varchar | 255 | | url | varchar | 255 | #### 三、实现方式 1. hash hash存在哈希碰撞问题 2. 自增序列算法 id自增+62进制编码,为什么使用62进制转换?62进制转换是因为62进制转换后只含数字+小写+大写字母。而64进制转换会含有/,+这样的符号(不符合正常URL的字符) ```$xslt 将传入的长链接存入数据库中,并记录创建时间,返回自增ID。 再根据自增id进行62进制转换,得出短链接,再记录进数据库。 ```