如何创建这种唯一的KEY 本帖最后由 satans18 于 2013-04-02 19:33:14 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <?phpfunction getRandStr($len){ $chars = array("0", "1", "2","3", "4", "5", "6", "7", "8", "9"); //换成a-z,A-Z 52种 $charsLen = count($chars) - 1; shuffle($chars); $output = ""; for ($i=0; $i<$len; $i++){ $output .= $chars[mt_rand(0, $charsLen)]; } return $output; }?> function getRandStr($len){ $str = "ABCDEFGHIJKLMNOPQRSTUVWXYZzbcdefghijklmnopqrstuvwxyz"; $output = ""; for ($i=0; $i<$len; $i++){ $output .= $str{mt_rand(0, 52)}; } return $output; }稍微修改了下,谢谢楼上两位结贴 求助:购物时订单号的传值和订单插入问题 正则匹配指定长度的数字要怎么写? 解决了不 php获取url中的参数 数据业务模型指的是什么? EclipsePHP Studio 2008 使用问题!! 无法实现所见即所得 后台访问 请教一个新人问题 在dreamweaver中写php程序为什么经常出现乱码? 千分问题之一:详情请看内容(谁能答对送一千分,up者有分,up三次以上者没分,回答问题除外) php 数据写入txt时的问题 php可以下载exe文件吗
<?php
function getRandStr($len){
$chars = array("0", "1", "2","3", "4", "5", "6", "7", "8", "9"); //换成a-z,A-Z 52种
$charsLen = count($chars) - 1;
shuffle($chars);
$output = "";
for ($i=0; $i<$len; $i++){
$output .= $chars[mt_rand(0, $charsLen)];
}
return $output;
}?>
$str = "ABCDEFGHIJKLMNOPQRSTUVWXYZzbcdefghijklmnopqrstuvwxyz";
$output = "";
for ($i=0; $i<$len; $i++){
$output .= $str{mt_rand(0, 52)};
}
return $output;
}稍微修改了下,谢谢楼上两位结贴