Home>Article>Backend Development> PHP verification code is not case sensitive

PHP verification code is not case sensitive

angryTom
angryTom Original
2019-10-31 10:32:39 4696browse

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 visitPHP 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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn