Home > Article > Backend Development > PHP verification code is not case sensitive
php verification code is not case-sensitive
First we use the strtolower function on the verification code stored in SESSION to It is converted to lowercase; then the content submitted by the user is also converted to lowercase using the strtolower function; and finally the comparison is done.
Code:
session_start(); $str_number = trim($_POST['number']); if(strtolower($_SESSION['rand'])==strtolower($str_number )){ echo "验证码正确"; }else{ echo "验证码不正确"; }
For more PHP related knowledge, please visit PHP Chinese website!
The above is the detailed content of PHP verification code is not case sensitive. For more information, please follow other related articles on the PHP Chinese website!