输入banner图图片脚本导航/分类

php生成短网址的实例代码

本文主要和大家分享php生成短网址的实例代码,希望大家能学会如何用php生成短网址。

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实现短网址跳转

php实现长网址和短网址的方法

php短网址超简单代码

以上就是php生成短网址的实例代码的详细内容,更多请关注Gxl网其它相关文章!