您的位置:首页 > 编程语言 > PHP开发

php生成短网址

2018-01-22 16:26 330 查看
function SuoUrl($url='')
{
$urlcode =$this->shorturl($url);
}
function shorturl($url){
$url=crc32($url);
$result=sprintf("%u",$url);
$res = $this->code62($result);
return $res;
}
function code62($result){
$show='';
while($x>0){
$s=$x % 62;
if ($s>35){
$s=chr($s+61);
}elseif($s>9&&$s<=35){
$s=chr($s+55);
}
$show.=$s;
$x=floor($x/62);
}
return $show;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  php 短网址 tp5