php生成短网址的方法
内容导读
收集整理的这篇技术教程文章主要介绍了php生成短网址的方法,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含909字,纯文字阅读大概需要2分钟。
内容图文
这篇文章主要介绍了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获取随机数组列表
php将时间差转换为字符串的实现
以上就是php生成短网址的方法的详细内容,更多请关注Gxl网其它相关文章!
内容总结
以上是为您收集整理的php生成短网址的方法全部内容,希望文章能够帮你解决php生成短网址的方法所遇到的程序开发问题。 如果觉得技术教程内容还不错,欢迎将网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。