字符串,验证码
Posted nfyx
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了字符串,验证码相关的知识,希望对你有一定的参考价值。
<?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));
//用来生成验证码
以上是关于字符串,验证码的主要内容,如果未能解决你的问题,请参考以下文章