Home  >  Article  >  PHP Framework  >  yii verification code cannot be displayed

yii verification code cannot be displayed

(*-*)浩
(*-*)浩Original
2019-11-07 14:15:082626browse

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();//加上这行
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);

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!

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