Home > php教程 > php手册 > 史上产生位数最短的随机唯一ID php函数

史上产生位数最短的随机唯一ID php函数

WBOY
Release: 2016-06-07 11:45:06
Original
1226 people have browsed it

产生位数最短的随机唯一ID php函数.可用于我们日常手机里收到的超连接如:XXXXXX详情点击:http://xxxx.com/user.php/m/o/i/n.bcuf1b中的bcuf1b
产生位数最短的随机唯一ID php函数.可用于我们日常手机里收到的短信超连接。如:XXXXXX详情点击:http://xxxx.com/user.php/m/o/i/n.bcuf1b中的bcuf1b<?php <br />     //Author:铜豌豆<br>     //QQ:309581329<br>     //Email:bestphper@126.com<br>     //http://gongwen.sinaapp.com<br>     function getRandOnlyId() {<br>         //新时间截定义,基于世界未日2012-12-21的时间戳。<br>         $endtime=1356019200;//2012-12-21时间戳<br>         $curtime=time();//当前时间戳<br>         $newtime=$curtime-$endtime;//新时间戳<br>         $rand=rand(0,99);//两位随机<br>         $all=$rand.$newtime;<br>         $onlyid=base_convert($all,10,36);//把10进制转为36进制的唯一ID<br>         return $onlyid;<br>     }<br>     //得到随机唯一id<br>     echo getRandOnlyId();<br> ?>

AD:真正免费,域名+虚机+企业邮箱=0元

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template