-
Notifications
You must be signed in to change notification settings - Fork 36
Online (下载加载识别网络上的验证码)
Amatist_Kurisu edited this page Jul 15, 2018
·
4 revisions
需要确保安装了 Composer 以及 PHP 版本大于 7 以及安装了GD扩展
- Composer 引入 kurisu/captcha_reader
composer require kurisu/captcha_reader
-
对
Config/app.php
文件进行配置 将useGroup
对应的值改成你需要的方案对应的方案名,这里的方案名和componentGroup
中的各个值一一对应(注意不要打错方案名,否则会无法加载到相应的方案类),目前支持的是以下四种方案以及对应的方案名:-
正方教务系统验证码
=>ZhengFangNormal
-
青果教务系统验证码
=>QinGuoNormal
-
neea.edu.cn验证码
=>NeeaNormal
-
天翼校园网登录验证码
=>TianYiNormal
-
-
在某个类中使用 (只是举个例子)
<?php
namespace App\Http\Controllers;
use CAPTCHAReader\src\App\IndexController;
class IdentifyController extends Controller
{
/**
* read CAPTCHA
*
* @return string
*/
public function identify()
{
$indexController = new IndexController();
$results = $indexController->entrance('https://raw.githubusercontent.com/Kuri-su/CAPTCHA_Reader/master/docs/sample/qinguo.png', 'online');
//支持直接传参数指定使用的方式
//$results = $indexController->entrance('https://raw.githubusercontent.com/Kuri-su/CAPTCHA_Reader/master/docs/sample/qinguo.png', 'online','QinGuoNormal');
//在 online 模式下,默认会在将图片加载到内存后删除下载的图片文件,如果需要保留这个图片文件,在第四个参数位置传 (bool)false
//$results = $indexController->entrance('https://raw.githubusercontent.com/Kuri-su/CAPTCHA_Reader/master/docs/sample/qinguo.png', 'online',null,false);
return results;
}
}
需要安装Composer
- 使用 git 将源文件拉取
git clone https://github.com/Kuri-su/CAPTCHA_Reader.git
- 使用Composer生成ClassMap
composer update
# 如果此处运行成功,会在输出 Success 的信息,并 CAPTCHA_Reader 目录下生成一个 verdor 文件夹
- 在脚本中使用
<?php
//!! 这里的 autoload.php 路径需要自己配置
require_once(__DIR__ . '/../../vendor/autoload.php');
use CAPTCHAReader\src\App\IndexController;
$indexController = new IndexController();
$results = $indexController->entrance('https://raw.githubusercontent.com/Kuri-su/CAPTCHA_Reader/master/docs/sample/qinguo.png', 'online');
//支持直接传参数指定使用的方式
//$results = $indexController->entrance('https://raw.githubusercontent.com/Kuri-su/CAPTCHA_Reader/master/docs/sample/qinguo.png', 'online','QinGuoNormal');
//在 online 模式下,默认会在将图片加载到内存后删除下载的图片文件,如果需要保留这个图片文件,在第四个参数位置传 (bool)false
//$results = $indexController->entrance('https://raw.githubusercontent.com/Kuri-su/CAPTCHA_Reader/master/docs/sample/qinguo.png', 'online',null,false);
dump($results);
至此,你便成功的开始使用 kurisu/captcha_reader 进行验证码的识别
- 文档wiki结构
- Get started (detail)
- FAQ
- 文件结构和类结构
- 配置文件介绍
- 按步骤介绍各个类
- 获取文件
- 预处理(降噪)
- 正方
- 青果
- neea
- tianyi
- 切割
- 正方
- 青果
- neea
- tianyi
- 识别
- 正方
- 青果
- neea
- tianyi
- 附录
- 部分毕业论文内容(用于开拓思路)