当空闲糟糕的时候,加强自己的操作数组的技巧,在下面写一小段代码,可以随机生成对应于数组的密码,并自动重复,没有想法,纯粹。


< PHP header('content-type:文本/ HTML;字符集= UTF-8);
makecard()函数
{
(0)set_time_limit;

/处理缓冲区
ob_end_clean();
ob_implicit_flush(真的);
回声str_pad(

如果(intval($ _post { 'num} > 0))$民= intval($ _post { 'num}); / /数量
如果(intval($ _post { 'point} > 0))$点= intval($ _post { 'point}); / /分
如果(intval($ _post { 'batch} > 0))=(_post美元美元批intval { 'batch}); / /批
如果(($ _post { 'ym}!=YM = { 'ym _post美元美元})); / /签发日期
其他YM =日期('ym美元);

如果($ = 0)返回;

100美元;

开始。

($ i = 1;$ i = $;$ + +)
{
$ SN = sprintf(% 02s %s 06s
为寻求= mt_rand(09999)。mt_rand(09999)。mt_rand(09999); / / 12位
美元开始= mt_rand(20);
$str = strtoupper(substr(MD5(美元寻求),美元开始,12));
$str = str_replace(O
$str = str_replace(0
$行=阵列('sn= > $锡,'password= > $str,'created= >时间(),'point= > $点);
检查
在这里插入数据代码。
print_r(合排);
}
回声结束。
printf(成功的一代:%s %s的密码万点
返回$;
结束函数

_post美元{ 'num} = 1;
_post美元{ 'point} = 10;
_post美元{ 'batch} = 10;
_post美元{ 'ym} = '1405;
Echo MakeCard();>




方法二:


< PHP
numlen = 16美元;
pwdlen = 10美元;
$ = 100; 100代组密码
snumarr美元=范围(0.9);
spwdarr = array_merge美元(美元snumarr,范围(A,Z));

卡=数组();
($ x = 0;$ x;
tempnumstr美元=阵();
为($我= 0;美元美元美元我<< numlen;i++){
tempnumstr { } = array_rand美元(美元snumarr);
}
temppwdstr美元=阵();
为($我= 0;美元美元美元我<< pwdlen;i++){
temppwdstr美元{ } = { array_rand spwdarr美元(美元spwdarr)};
}
{ } { $卡$ X‘不'} =崩溃('',tempnumstr美元);
{ } { $卡$ X 'pwd} =崩溃('',temppwdstr美元);
}
array_unique(美元卡);
print_r(美元卡);
>



以上是本文的全部内容,希望大家能喜欢。