Home >Backend Development >PHP Tutorial >A simple PHP verification code program code_PHP tutorial
There are many programs for generating PHP verification codes online. Now I will share with you a super good PHP verification code program code. Friends in need can refer to it.
Verification code recognition is generally divided into the following steps:
1. Take out the font
2. Binarization
3. Calculate features
4. Control sample
The code is as follows
|
Copy code
|
||||
|
function _code($_code_length = 4, $_width = 75, $_height = 25){
$_SESSION["code"] = $_nmsg;
imageline($_img, mt_rand(0,$_width), mt_rand(0, $_height),mt_rand(0,$_width), mt_rand(0, $_height), $_md_color); }The code is as follows | Copy code |
$getcode = $_POST['code']; if( $_SESSION["code"] = $getcode ) { echo 'Verify it is legal, go to the next step'; unset( $_SESSION["code"] ); } else { echo 'The verification code is incorrect'; header('location:vial.php'); } http://www.bkjia.com/PHPjc/629627.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/629627.htmlTechArticleThere are many programs for generating PHP verification codes online. Let me share with you a very good PHP verification code program. Code, friends in need can refer to it. Verification code recognition is generally divided into the following steps... |