$url = substr(md5(time().mt_rand(1,1000000)),8,16);
$code = shortUrl2($url);
/**
* 短连接方法一
* @param unknown $url
* @return string
*/
if(!function_exists('shortUrl2')) {
function shortUrl2($url)
{
$result = sprintf("%u", crc32($url));
$show = '';
while ($result > 0) {
$s = $result % 62;
if ($s > 35) {
$s = chr($s + 61);
} elseif ($s > 9 && $s <= 35) {
$s = chr($s + 55);
}
$show .= $s;
$result = floor($result / 62);
}
return $show;
}
}