Home  >  Article  >  PHP Framework  >  How to change the verification code in yii framework

How to change the verification code in yii framework

(*-*)浩
(*-*)浩Original
2019-12-14 10:28:552420browse

How to change the verification code in yii framework

In the Yii2 framework, if you use the verification code in the form, you will find a strange little problem, that is, the verification code image will not be refreshed when the web page is refreshed.

Most solutions on the Internet are solved by modifying the code in vendor/yiisoft/yii2/captcha/CaptchaAction.php

1. Modify getVerifyCode() Method's parameter default value (Recommended learning: yii framework )

How to change the verification code in yii framework The default value of the parameter $ Regneate is changed from false to true, so , the program will regenerate it every time it gets the verification code.

2. Modify the run() method

How to change the verification code in yii frameworkIn the place pointed by the red arrow, add a parameter true, which can also solve the problem.

The above is the detailed content of How to change the verification code in yii framework. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn