×ðÁú¿­Ê±

̽ÌÖthinkphpÑéÖ¤ÂëµÄʵÏÖ

Ëæ×Å»¥ÁªÍøÊÖÒÕµÄÉú³¤£¬ÑéÖ¤ÂëµÄÓ¦ÓÃÔ½À´Ô½Æձ飬Ëü¿ÉÒÔÓÐÓñÜÃâ»úеÈ˶ñÒâ×¢²á¡¢Ì¸ÂÛ¡¢ÅÀ³æµÈÐÐΪ£¬È·±£ÍøÕ¾µÄÇå¾²ºÍÕý³£ÔËÐУ¬ÎªÁ˸üºÃµØʵÏÖÑéÖ¤ÂëµÄ¹¦Ð§£¬ÏÖÔÚÎÒÃÇÀ´Ì½ÌÖthinkphpÑéÖ¤ÂëµÄʵÏÖ¡£

Ò»¡¢ÑéÖ¤ÂëµÄ¿´·¨ºÍ×÷ÓÃ

ÑéÖ¤Â루ӢÎÄÈ«³Æ£ºCompletely Automated Public Turing test to tell Computers and Humans Apart£©ÊÇÒ»ÖÖ×Ô¶¯Çø·ÖÅÌËã»ú³ÌÐòºÍÈËÀàÓû§µÄ¹«¹²È«×Ô¶¯·´ÏòͼÁé²âÊÔ£¬Ò²¾ÍÊÇÓÃÀ´Çø·ÖÓû§ÊÇ»úеÕÕ¾ÉÈ˵ÄÒ»ÖÖÊÖÒÕ¡£ÑéÖ¤ÂëµÄÓ¦ÓÃÊ®·ÖÆձ飬°üÀ¨µ«²»ÏÞÓÚ×¢²á¡¢µÇ¼¡¢Ì¸ÂÛ¡¢ËÑË÷¡¢Í¶Æ±¡¢ÅÀ³æµÈ³¡¾°£¬ÔÚ»¥ÁªÍøµÄÇå¾²°ü¹ÜÖÐÆðµ½ÁËÖÁ¹ØÖ÷ÒªµÄ×÷Óá£

¶þ¡¢thinkphpÑéÖ¤ÂëµÄʵÏÖ°ì·¨

×°ÖÃthinkcaptcha

Ê×ÏÈ£¬ÎÒÃÇÐèÒªÔÚthinkphpÖÐ×°ÖÃthinkcaptchaÀ©Õ¹°ü£¬¿ÉÒÔͨ¹ýÒÔÏÂÏÂÁî×°Öãºcomposer require topthink/think-captcha

Á¬Ã¦Ñ§Ï°¡°PHPÃâ·ÑѧϰÌõ¼Ç£¨ÉîÈ룩¡±£»

ÉèÖÃconfig.phpÎļþ

ÔÚapplicationÎļþ¼ÐÏ£¬ÕÒµ½config.phpÎļþ£¬·­¿ªºó¿ÉÒÔ¿´µ½ÈçÏ´úÂ룺

//ÑéÖ¤Âë
'captcha' => [
    // ÑéÖ¤Âë×Ö·ûÜöÝÍ
    'codeSet' => '2345678abcdefhijkmnpqrstuvwxyzABCDEFGHJKLMNPQRTUVWXY',
    // ÑéÖ¤Âë×ÖÌå¾Þϸ(px)£¬Æ¾Ö¤ËùÐè¾ÙÐÐÉèÖÃÑéÖ¤Âë×ÖÌå¾Þϸ
    'fontSize' => 25,
    // ÊÇ·ñ»­»ìÏýÇúÏß
    'useCurve' => true,
    // ÑéÖ¤ÂëͼƬ¸ß¶È£¬Æ¾Ö¤ËùÐè¾ÙÐÐÉèÖÃÑéÖ¤ÂëͼƬ¸ß¶È
    'imageH' => 50,
    // ÑéÖ¤ÂëͼƬ¿í¶È£¬Æ¾Ö¤ËùÐè¾ÙÐÐÉèÖÃÑéÖ¤ÂëͼƬ¿í¶È
    'imageW' => 150,
    // ÑéÖ¤ÂëλÊý£¬Æ¾Ö¤ËùÐè¾ÙÐÐÉèÖÃÑéÖ¤ÂëλÊý
    'length' => 4,
    // ÑéÖ¤ÀֳɺóÊÇ·ñÖØÖÃ
    'reset' => true
]

µÇ¼ºó¸´ÖÆ

ƾ֤ÐèÇó£¬ÎÒÃÇ¿ÉÒÔÐÞ¸ÄÆäÖеIJÎÊýÀ´¾ÙÐиöÐÔ»¯ÉèÖá£

ÔÚ¿ØÖÆÆ÷ÖÐŲÓÃÑéÖ¤ÂëÒªÁì

use think\captcha\Captcha;

class Index
{
   public function verify()
   {
      $config = [
         'codeSet' => '0123456789',
         'useZh'   => false,
         'fontSize'=> 20, 
         'length' => 4,
         'useNoise' => false,
      ]; //ÑéÖ¤ÂëÉèÖÃ
      $captcha = new Captcha($config);
      return $captcha->entry(); 
   }
}

µÇ¼ºó¸´ÖÆ

ÒÔÉÏÄÚÈÝÖУ¬$configÊÇÓÃÀ´ÉèÖÃÑéÖ¤Âë²ÎÊýµÄ£¬ÈçcodeSetΪ¿ÉÑ¡×Ö·ûÜöÝÍ£¬useZhΪÊÇ·ñ¿ªÆôÖÐÎÄ£¬fontSizeΪÑéÖ¤Âë×ÖÌå¾Þϸ£¬lengthΪÑéÖ¤ÂëλÊý£¬useNoiseΪÊÇ·ñ¿ªÆô×ÌÈÅÏߵȣ¬

ÔÚÊÓͼÖÐŲÓÃÑéÖ¤Âë

ÔÚÐèҪʹÓÃÑéÖ¤ÂëµÄform±íµ¥ÖУ¬¿ÉÒÔͨ¹ýÒÔÏ´úÂëŲÓÃÑéÖ¤Â룺


µÇ¼ºó¸´ÖÆ        

ÆäÖÐcaptcha_img()ÒªÁìÊÇthinkcaptchaÀ©Õ¹°ü×Ô´øµÄÑéÖ¤ÂëÊä³öÒªÁ죬¿ÉÓÃÓÚÖ±½ÓÊä³öÌìÉúµÄÑéÖ¤Âë¡£

ÑéÖ¤ÑéÖ¤Âë

×îºó£¬ÔÚºó¶ËÐèÒª¶ÔÑéÖ¤Âë¾ÙÐÐÑéÖ¤£¬ÈôÊÇÓû§ÊäÈëµÄÑéÖ¤ÂëºÍÌìÉúµÄÑéÖ¤Âë·×ÆçÖ£¬ÔòÑé֤ʧ°Ü¡£

use think\captcha\Captcha;

class Index
{
   public function login()
   {
      $captcha = new Captcha();
      if (!$captcha->check(input('code'))) {
         $this->error('ÑéÖ¤Âë¹ýʧ');
      } else {
         //ÆäËûÓªÒµÂß¼­
      }
   }
}

µÇ¼ºó¸´ÖÆ

ÒÔÉÏ´úÂëÖУ¬$captcha->check(input(‘code’))ÓÃÓÚ¼ì²âÓû§ÊäÈëµÄÑéÖ¤ÂëÊÇ·ñÓëÌìÉúµÄÑéÖ¤ÂëÒ»Ö£¬ÈôÊÇ·×ÆçÖÂÔòÌø³öÌáÐÑ¡£

Èý¡¢×ܽá

ÓÉÓÚÑéÖ¤ÂëÊÇ°ü¹ÜÍøÕ¾Çå¾²µÄÖ÷ÒªÒ»»·£¬Òò´ËthinkphpÒ²ÌṩÁ˸»ºñµÄÑéÖ¤Â빦Ч£¬ÔÚʵÏÖÑéÖ¤ÂëµÄÀú³ÌÖÐÐèҪעÖØÉèÖòÎÊýºÍŲÓÃÒªÁ죬ͬʱҲÐèÒª½«ÑéÖ¤ÂëµÄʵÏÖÓëÓªÒµÂß¼­ÍŽáÆðÀ´£¬ÇÉÃîµØʹÓÃÑéÖ¤ÂëµÄÓÅÊÆ£¬±£»¤ÍøÕ¾µÄÇå¾²ºÍÁ¼ÐÔÉú³¤¡£

ÒÔÉϾÍÊÇ̽ÌÖthinkphpÑéÖ¤ÂëµÄʵÏÖµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí£¬°æȨÕùÒéÓë±¾Õ¾Î޹أ¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í×ðÁú¿­Ê±ÂËÓÍ»úÍø¹Ù·½Ì¬¶È£¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ£¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢£¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢£¬ÇëÄúÁ¬Ã¦ÁªÏµ×ðÁú¿­Ê±ÊµÊ±ÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎ壬9:30-18:30£¬½ÚãåÈÕÐÝÏ¢

QR code
¡¾ÍøÕ¾µØͼ¡¿¡¾sitemap¡¿