Home > Article > PHP Framework > 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!