Get the App
SLTechnology News&Howtos  ›  Development  › 

How to download verification code class with composer by thinkphp5 prompting error

Shulou Source: shulou.com Published: 2022-06-03 17:46:34 10月29日 Update

This article is about how thinkphp5 uses composer to download verification code class prompts for errors. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

1. First download the CAPTCHA plug-in using Composer. If there is no composer, click here to download and install

After the installation is complete, use the following command to modify the composer configuration file and use the domestic image. You know why.

Composer config-g repo.packagist composer https://packagist.phpcomposer.com

Then open the cmd window and enter the project root directory. For example, download the CAPTCHA plug-in in (D:/www/blog, cd to this directory first) using the following command:

Composer require topthink/think-captcha 1 (Note: / think-captcha 1.0 should be used for the verification code of the thinkphp5.0 version, otherwise the installation will fail) the installation failure message is shown below:

The path after download is: vendor\ topthink\ think-captcha\ src

2. Make sure that the following two items are configured as true in the project configuration file application/config.php:

'auto_start' = > true,' url_route_on' = > true

Then add to the configuration file:

'captcha' = > [/ / CAPTCHA character set' codeSet' = > '2345678 abcdefhijkmpqrstuvwxyzABCDEFGHJKLMNPQNPQRTUVWXY font size (px)' fontSize' = > 20, / / whether to draw confusion curve 'useCurve' = > true, / / CAPTCHA picture height' imageH' = > 30, / CAPTCHA picture width 'CAPTCHA = > 100 / / verify the number of code points' length' = > 4, / / reset 'reset' = > true] after successful verification

For more detailed parameter configuration, refer to the instructions in the vendor\ topthink\ think-captcha\ src\ Captcha.php class file.

3. Display the verification code:

Tags: Validation files configuration errors prompts pictures methods content parameters commands plug-ins more versions directories articles paths projects references good practical Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux Shulou Information Redmi macOS vpn