php中如何生成短网址-创新互联

今天就跟大家聊聊有关php中如何生成短网址,可能很多人都不太了解,为了让大家更加了解,小编给大家总结了以下内容,希望大家根据这篇文章可以有所收获。

成都创新互联服务项目包括怒江州网站建设、怒江州网站制作、怒江州网页制作以及怒江州网络营销策划等。多年来,我们专注于互联网行业,利用自身积累的技术优势、行业经验、深度合作伙伴关系等,向广大中小型企业、政府机构等提供互联网行业的解决方案,怒江州网站推广取得了明显的社会效益与经济效益。目前,我们服务的客户以成都为中心已经辐射到怒江州省份的部分城市,未来相信会继续扩大服务区域并继续获得客户的支持与信任!

php生成短网址

$chars=array("a","b","c","d","e","f","g","h",
    "i","j","k","l","m","n","o","p",
    "q","r","s","t","u","v","w","x",
    "y","z","0","1","2","3","4","5",
    "6","7","8","9","a","b","c","d",
    "e","f","g","h","i","j","k","l",
    "m","n","o","p","q","r","s","t",
    "u","v","w","x","y","z");
$salt="www.joneto.com";
$hash=md5("http://www.sina.com".$salt);
$rs=array();
for($i=0;$i<4;$i++){
 $temp=substr($hash, $i*8,8);
 $temp=base_convert($temp, 16, 10) & base_convert("3fffffff", 16, 10);

 $str="";
 for($j=0;$j<6;$j++){
  $subtemp=$temp & intval(base_convert("3d", 16, 10));
  $str.=$chars[$subtemp];
  $temp=$temp>>5;
 }
 unset($temp);
 $rs[]=$str;
}
print_r($rs);
?>

看完上述内容,你们对php中如何生成短网址有进一步的了解吗?如果还想了解更多知识或者相关内容,请关注创新互联行业资讯频道,感谢大家的支持。


当前名称:php中如何生成短网址-创新互联
文章起源:http://azwzsj.com/article/dcijhs.html