Home> PHP Framework> YII> body text

Verification code is not displayed in yii2.0

王林
Release: 2020-02-18 16:12:41
Original
2534 people have browsed it

Verification code is not displayed in yii2.0

1. First, make sure that the captcha method in your controller is accessible and has the assigned permissions. This is set in the rule.

2. Make sure your PHP GD plug-in has been enabled;

3. If it still does not display, then try the following method:

(Recommended tutorial:yii framework)

Solution:

First find yii\framework\web\widgets\captcha\CCaptchaAction.php;

Then you can try the following Methods to solve:

1. Try to delete spaces in the text;

2. Add error_reporting(0) at the top of the php file;

3. Add it before the header output ob_clean(); That is:

ob_clean();//加上这行
Copy after login
header('Pragma: public'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Content-Transfer-Encoding: binary'); header("Content-type: image/png"); imagepng($image); imagedestroy($image);
Copy after login

For more programming-related content, please pay attention to theProgramming Introductioncolumn on the php Chinese website!

The above is the detailed content of Verification code is not displayed in yii2.0. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!