<?php
$ary = [0,1,2,3,4,5,6,7,8,9];
$a = [a
,b
,c
,d
,e
,f
,g
,h
,i
,j
,k
,l
,m
,n
,o
,p
,q
,r
,s
,t
,u
,v
,w
,x
,y
,z
];
$A = [A
,B
,C
,D
,E
,F
,G
,H
,I
,J
,K
,L
,M
,N
,O
,P
,Q
,R
,S
,T
,U
,V
,W
,X
,Y
,Z
,];
$a1 = array_merge($ary,$a,$A);
$ay = '';
$ay .= $a1[mt_rand(0,61)] .$a1[mt_rand(0,61)].$a1[mt_rand(0,61)].$a1[mt_rand(0,61)];
?>
<h1 id
="z"><?php echo $ay ?></h1
>
<input type
="text" id
="val1">
<button id
='bt'>确认
</button
>
<script src
="jquery-3.3.1.min.js"></script
>
<script
>
$
('#bt').click(function () {
if($
('#z').text() != $
('#val1').val()){
alert('验证码输入错误');
}else {
alert('太棒了!正确');
}
})
</script
>
运用jquery和php两种函数 -------------勿喷本人只是练习数组
转载请注明原文地址:https://blackberry.8miu.com/read-9288.html