时间:2021-05-26
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="".$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);
?>
声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。
分享一个php短网址的生成代码。复制代码代码如下:urlShort
怎么利用百度将长网址生成短网址?百度有一个网址生成软件,下面我们一起来看看怎么利用这个短网址生成器,来生成短网址。软件名称:WAX百度短地址生成器v2.0绿色版
suo.im是“缩我短链接”这个工具平台,生成的短网址前缀。 利用该平台,用户可以将各种长网址,缩短成以suo.im开头的短网址。 大家直接访问suo.im
短网址流行已经有一段时间了,尤其是在新浪微博上更是频繁出现,但应该很多人都不知道这个东东是怎么实现的,其实短网址也挺容易的。下面我们对于生成短网址的思路以及使用
php生成短网址原理:1.将原网址做crc32校验,得到校验码。2.使用sprintf('%u')将校验码转为无符号数字。3.对无符号数字进行求余62操作(大小