Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

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

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

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:

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report