字符串,验证码

<?php

header('content-type:text/html;charset=utf-8');
// array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)
foreach (range(0, 12) as $number) {
    echo $number;
}
echo "<br/>";
print_r(range(0,9));
echo "<br/>";
print_r(range("a","z")) ;
echo "<br/>";
print_r(range("A","Z")) ;


echo "<br/>";
 $text=implode(range(0,9));
 $text.=implode(range("a","z"));
 $text.=implode(range("A","Z"));

 $text=str_shuffle($text);
 $text=substr($text,0,5);

 echo $text;
 echo "<br/>";
 //openssl_random_pseudo_bytes($length)
 $str=openssl_random_pseudo_bytes(5);
var_dump($str);
print_r($str);


echo "<br/>";
echo implode(array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12));
//用来生成验证码

posted @ 2019-03-06 17:38  牛粪也香  阅读(169)  评论(0编辑  收藏  举报