为了账号安全,请及时绑定邮箱和手机立即绑定

PHP实现验证码 点击提交后页面没反应 是什么原因?

PHP实现验证码 点击提交后页面没反应 是什么原因?

PHP
心有猛虎_细嗅蔷薇 2017-03-05 18:11:20
form.php<?php     if (isset($_REQUEST['authcode'])){         session_start();         if ($_REQUEST['authcode'] == $_SESSION['authcode']){             echo "输入正确";         }else{             echo "输入错误";         }         exit();     } ?> <!doctype html> <html> <head>     <meta charset="UTF-8">     <title></title> </head> <body>     <from method="post" action="./form.php">         <p>验证码图片:             <img src="./captcha.php?r=<?php echo rand();?>">         </p>         <p>请输入验证码:             <input type="text" name="authcode" value="">         </p>         <p><input type="submit" value="提交" style="padding: 6px 20px;"></p>     </from> </body> </html>captcha.php<?php     session_start();     $image = imagecreatetruecolor(100,30);     $bgColor = imagecolorallocate($image,255,255,255);     imagefill($image,0,0,$bgColor); /*    for($i=0;$i<4;$i++){         $font = 6;         $col = imagecolorallocate($image,rand(0,120),rand(0,120),rand(0,120));         $s = rand(0,9);         $x = ($i*100/4)+rand(5,10);         $y = rand(5,10);         imagestring($image,$font,$x,$y,$s,$col);     }*/     /*字母+数字*/     $captch_code = '';     for($i=0;$i<4;$i++){         $font = 6;         $col = imagecolorallocate($image,rand(0,120),rand(0,120),rand(0,120));         $data = "abcdefghgkmnpqrstuvwxyABCDEFGHJKLMNPQRSTUVWXYZ123456789";         $s = substr($data,rand(0,strlen($data)-1),1);         $captch_code.=$s;         $x = ($i*100/4)+rand(5,10);         $y = rand(5,10);         imagestring($image,$font,$x,$y,$s,$col);     }     $_SESSION['authcode'] = $captch_code;     /*增加点干扰元素*/     for($i=0;$i<200;$i++){         $pointColor = imagecolorallocate($image,rand(50,200),rand(50,200),rand(50,200));         imagesetpixel($image,rand(1,99),rand(1,29),$pointColor);     }     /*增加线的干扰*/     for($i=0;$i<3;$i++){         $lineColor = imagecolorallocate($image,rand(80,220),rand(80,220),rand(80,220));         imageline($image,rand(1,99),rand(1,29),rand(1,99),rand(1,29),$lineColor);     }     header('Content-type: image/png');     imagepng($image);     imagedestroy($image);有学过的同学 给指点指点,最容易忽视的问题在哪?
查看完整描述

3 回答

已采纳
?
西兰花伟大炮

TA贡献376条经验 获得超318个赞


form表单写成from肯定不行啊,哥

查看完整回答
2 反对 回复 2017-03-06
?
慕设计5951087

TA贡献8条经验 获得超1个赞

没发现那里有bug呀!
查看完整回答
反对 回复 2017-03-06
  • 3 回答
  • 1 关注
  • 2052 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信