<?php
header('content-type:text/html;charset=utf-8');
echo '验证码为:';
$a='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
for ($i=0; $i <4; $i++) {
echo $a{rand(0,strlen($a)-1)};
}
header('content-type:text/html;charset=utf-8');
echo '验证码为:';
$a='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
for ($i=0; $i <4; $i++) {
echo $a{rand(0,strlen($a)-1)};
}
2018-07-30
老师如果都和King 一样,我们还有什么理由不去学好呢?灰心的时候看看king老师的讲解,你会有不一样的收获
2018-05-31
function getRand($length){
$parrent = "abcdefghijklmnopqxyzrstuvwABCDEFGHIJKLMNOPQXYZRSTUVW0123456789";
$key = "";
for ($i=0; $i < $length; $i++) {
$key .= $parrent{mt_rand(0,strlen($parrent)-1)};
}
return $key;
}
echo getRand(4);
$parrent = "abcdefghijklmnopqxyzrstuvwABCDEFGHIJKLMNOPQXYZRSTUVW0123456789";
$key = "";
for ($i=0; $i < $length; $i++) {
$key .= $parrent{mt_rand(0,strlen($parrent)-1)};
}
return $key;
}
echo getRand(4);
2018-05-21
<?php
header('content-type:text/html;charset=utf-8');
echo '验证码为:';
$a='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
for ($i=0; $i <4; $i++) {
echo $a{rand(0,strlen($a)-1)};
}
header('content-type:text/html;charset=utf-8');
echo '验证码为:';
$a='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
for ($i=0; $i <4; $i++) {
echo $a{rand(0,strlen($a)-1)};
}
2018-05-19
function str ($str)
{
$string = '';
for ($i = 0; $i < strlen($str); $i ++) {
$string .= $str{mt_rand(0, strlen($str) - 1)};
if (strlen($string) == 4) return $string;
}
}
$str = 'hrllo1343204980942aefekljhrakg';
echo str($str);
{
$string = '';
for ($i = 0; $i < strlen($str); $i ++) {
$string .= $str{mt_rand(0, strlen($str) - 1)};
if (strlen($string) == 4) return $string;
}
}
$str = 'hrllo1343204980942aefekljhrakg';
echo str($str);
2018-04-18
$str='abcdefg';
$str{1}='';
echo $str;
Cannot assign an empty string to a string offset in
$str{1}='';
echo $str;
Cannot assign an empty string to a string offset in
2018-03-14