不看后悔系列,技術(shù)大牛都是樂于分享和提攜后輩的,這也是能成為技術(shù)大牛的潛質(zhì)體現(xiàn)。
2017-08-09
function yam($length){
$a="1234567890";
$b="qwertyuiopasdfghjklzxcvbnm";
$c="QWERTYUIOPASDFGHJKLZXCVBNM";
$d=$a.$b.$c;
for ($e=0;$e<$length;$e++){
//echo $d{mt_rand(1, strlen($d)-1)};
$f{$e}=$d{mt_rand(1, strlen($d)-1)};
}
return $f;
}
//yam(4);
$g=yam(4);
foreach ($g as $key=>$x){
echo $x;
}
$a="1234567890";
$b="qwertyuiopasdfghjklzxcvbnm";
$c="QWERTYUIOPASDFGHJKLZXCVBNM";
$d=$a.$b.$c;
for ($e=0;$e<$length;$e++){
//echo $d{mt_rand(1, strlen($d)-1)};
$f{$e}=$d{mt_rand(1, strlen($d)-1)};
}
return $f;
}
//yam(4);
$g=yam(4);
foreach ($g as $key=>$x){
echo $x;
}
2017-07-28
function getCode($length = 4) {
$varcode = "0123456789qwertyuiopasdfgjklzxcbnmvQWERTYUIOPASDLKFJHGZBXNCMV";
$relult = "";
for ($i = 0; $i < $length; $i++) {
$relult{$i} = $varcode{mt_rand(0,strlen($varcode))};
}
return $relult;
}
echo getCode();
$varcode = "0123456789qwertyuiopasdfgjklzxcbnmvQWERTYUIOPASDLKFJHGZBXNCMV";
$relult = "";
for ($i = 0; $i < $length; $i++) {
$relult{$i} = $varcode{mt_rand(0,strlen($varcode))};
}
return $relult;
}
echo getCode();
2017-07-11
$str2{1} = '' 輸出 報錯 Warning: Cannot assign an empty string to a string offset in E:\www\myself\string\index2.php on line 35
2017-06-13