-
Notifications
You must be signed in to change notification settings - Fork 68
Expand file tree
/
Copy pathstudy.php
More file actions
52 lines (44 loc) · 1.14 KB
/
study.php
File metadata and controls
52 lines (44 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
/**
* Created by mohuishou<1@lailin.xyz>.
* User: mohuishou<1@lailin.xyz>
* Date: 2016/5/1 0001
* Time: 20:44
*/
namespace Mohuishou\ImageOCR\Example;
use Minho\Captcha\CaptchaBuilder;
require_once 'vendor/autoload.php';
$img_path=__DIR__."/img/1.png";
if (isset($_POST['send'])&&$_POST['send']=="send") {
$ocr=new OCR($img_path);
$ocr->study($_POST['code']);
echo "<script>location.href='./study.php?t=".time()."'</script>";
$ocr=null;
} else {
$captch = new CaptchaBuilder();
$captch->initialize([
'width' => 150, // 宽度
'height' => 50, // 高度
'line' => false, // 直线
'curve' => false, // 曲线
'noise' => 0, // 噪点背景
'fonts' => ["./fonts/num.ttf"] // 字体
]);
$captch->create();
$captch->save($img_path, 1);
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Study</title>
</head>
<body>
<form action="" method="post">
<img src="img/1.png">
<input type="text" name="code">
<input name="send" type="submit" value="send" />
</form>
</body>
</html>