From 8026a95f2767d3d12b454689ac564d65840a32a3 Mon Sep 17 00:00:00 2001 From: admininfo Date: Thu, 15 Mar 2018 10:26:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=8E=B7=E5=8F=96=E6=98=8E?= =?UTF-8?q?=E6=96=87=E9=AA=8C=E8=AF=81=E7=A0=81=E6=96=B9=E6=B3=95=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Captcha.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/Captcha.php b/src/Captcha.php index 09ad692..10b498d 100644 --- a/src/Captcha.php +++ b/src/Captcha.php @@ -50,6 +50,7 @@ class Captcha private $im = null; // 验证码图片实例 private $color = null; // 验证码字体颜色 + private $captcha_code = null; // 明文验证码 /** * 架构方法 设置参数 @@ -192,6 +193,9 @@ public function entry($id = '') } } + // 保存原始明文验证码 + $this->captcha_code = strtoupper(implode('', $code)); + // 保存验证码 $key = $this->authcode($this->seKey); $code = $this->authcode(strtoupper(implode('', $code))); @@ -209,6 +213,17 @@ public function entry($id = '') return response($content, 200, ['Content-Length' => strlen($content)])->contentType('image/png'); } + /** + * 获取明文验证码 + * @author kangkst + * @since 1.0.0 + * @date 2018-03-15 10:24:53 + * @return null + */ + public function getCaptchaCode() + { + return $this->captcha_code; + } /** * 画一条由两条连在一起构成的随机正弦函数曲线作干扰线(你可以改成更帅的曲线函数) *