Home > PHP Framework > YII > body text

yii verification code cannot be displayed

(*-*)浩
Release: 2019-11-07 14:15:08
Original
2649 people have browsed it

yii verification code cannot be displayed

No display: (Recommended learning: yii tutorial )

## First guarantee your controler The captcha method inside is accessible and assigned permissions, which are set in the rule.

Second, ensure that your PHP GD plug-in has been enabled

Third, if it still does not display, then try this method , someone else told me.

Solution: First find yii\framework\web\widgets\captcha\CCaptchaAction.php, you can try the following methods to solve it:

1 Try to delete the spaces in the text

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

3 Add ob_clean(); before the header output; 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

The above is the detailed content of yii verification code cannot be displayed. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
yii
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template