iktbd/captcha-image 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

iktbd/captcha-image

Composer 安装命令:

composer require iktbd/captcha-image

包简介

Make your security captcha image

README 文档

README

Make your security captcha image

alt text

Features

  • Make your own captcha image and use
  • Make your system safe
  • More!

Installation & loading

captcha-image is available on Packagist (using semantic versioning), and installation via Composer is the recommended way to install captcha-image. Just add this line to your composer.json file:

"iktbd/captcha-image": "^2.00"

or run

composer require iktbd/captcha-image

Note that the vendor folder and the vendor/autoload.php script are generated by Composer; they are not part of captcha-image.

Use the captcha-image

Create captcher

<?php
use Iktbd\CaptchaImage\Captcha;

//Set your password as your wish
$password='djhfhdfywh53477';

//Create new captcha
$src_string=Captcha::create($password);

Use the $src_string in the html image

<form id="" action="#" method="post">
<img src="{{$src_string}}" height="50" width="250">
<input type="text" name="captcha_text" value="">
<input type="submit" value="Submit">
</form>

Varify Captcha data

<?php
use Iktbd\CaptchaImage\Captcha;


//Set your same password
$password='djhfhdfywh53477';

//Get the input value from the form submit
$text=$_POST['captcha_text'];

//Check submitted captcha data
$result=Captcha::verify($password,$text);

if($result==true)
{
    echo 'Captcha is correct';
}
else
{
    echo 'Captcha is wrong';
}

Note

  • If you want to create a new captcha and verify your old submitted captcha then verify your old submitted captcha first then create new captcha
  • You should remember that every new captcha generate a new session and delete the old session.
  • So, if you create a new captcha than if you verify the old submitted captcha then it will return false. Because the old captcha data already deleted when you create a new captcha

Error Note

  • Be sure that your PHP GD extension is enable else you will get an error.
  • If your PHP GD extension is not enable, then enable the GD extension.
  • To enable PHP GD extension, go to your cpanel then go to PHP version selector then tick the GD check box and save it.
  • Or check if in your php.ini file has the following line ;extension=gd
  • If exists, change it to extension=gd
  • If not found, Add this extension=gd to your php.ini

iktbd/captcha-image 适用场景与选型建议

iktbd/captcha-image 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 16 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 06 月 30 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 iktbd/captcha-image 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 iktbd/captcha-image 我们能提供哪些服务?
定制开发 / 二次开发

基于 iktbd/captcha-image 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 16
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 6
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-06-30