src/Leevel/Seccode/Seccode.php
public function display($code = null, ?string $outPath = null, bool $autoCode = true, string $autoType = self::ALPHA_UPPERCASE): void
    {
        if (is_int($code) && $autoCode) {
            $this->autoCode($code, $autoType);
        } else {
            $code && $this->code($code);
        }

        $resImage = imagecreatefromstring($this->makeBackground());

        if ($this->option['adulterate']) {
            $this->makeAdulterate($resImage);
        }

        $this->makeTtfFont($resImage);

        if ($outPath) {
            create_directory(dirname($outPath));
            imagepng($resImage, $outPath, 9);
        } else {
            // @codeCoverageIgnoreStart
            header('Content-type: image/png');
            imagepng($resImage);
            // @codeCoverageIgnoreEnd
        }

        imagedestroy($resImage);
    }
public function display($code = null, ?string $outPath = null, bool $autoCode = true, string $autoType = self::ALPHA_UPPERCASE): void
    {
        if (is_int($code) && $autoCode) {
            $this->autoCode($code, $autoType);
        } else {
            $code && $this->code($code);
        }

        $resImage = imagecreatefromstring($this->makeBackground());

        if ($this->option['adulterate']) {
            $this->makeAdulterate($resImage);
        }

        $this->makeTtfFont($resImage);

        if ($outPath) {
            create_directory(dirname($outPath));
            imagepng($resImage, $outPath, 9);
        } else {
            // @codeCoverageIgnoreStart
            header('Content-type: image/png');
            imagepng($resImage);
            // @codeCoverageIgnoreEnd
        }

        imagedestroy($resImage);
    }
设置验证码

@param mixed  $code
@param string $outPath
@param bool   $autoCode
@param string $autoType