时间:2021-07-01 10:21:17 帮助过:6人阅读
/** 生成短网址
* @param String $url 原网址
* @return String
*/
function dwz($url){
$code = sprintf('%u', crc32($url));
$surl = '';
while($code){
$mod = $code % 62;
if($mod>9 && $mod<=35){
$mod = chr($mod + 55);
}elseif($mod>35){
$mod = chr($mod + 61);
}
$surl .= $mod;
$code = floor($code/62);
}
return $surl;
}