top-think / think-captcha

thinkphp 验证码类库

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

配置文件修改length后会导致math验证图片显示不完整

linjialiang opened this issue · comments

配置文件修改length后会导致math验证图片显示不完整

问题出在: generate() 方法下的 $this->length = 5; 对 create() 方法无效

protected function generate(): array
{
    $bag = '';

    if ($this->math) {
        $this->length = 5;

我是这样解决的:在 create() 方法下增加一个$this->length = 5;

public function create(string $config = null, bool $api = false): Response
{
    $this->configure($config);

    if($this->math){
        $this->length = 5;
    }