Home > Article > Backend Development > php verification code not showing on screen
Reasons and solutions for the PHP verification code not being displayed:
1. If it is utf-8, it is possible that the BOM has not been cleared
2. There is output before Header("Content-type: image/PNG");
3. The first line of PHP hides code, such as spaces, carriage returns, etc.
Solution code:
$image_width=70; //设置图像宽度 $image_height=18; //设置图像高度 $new_number=$_GET[num]; //$new_number=5; $num_image=imagecreate($image_width,$image_height); //创建一个画布 imagecolorallocate($num_image,255,255,255); //设置画布的颜色 $black=imagecolorallocate($num_image,0,0,0); /**/for($i=0;$iRecommended tutorial: PHP video tutorial
The above is the detailed content of php verification code not showing on screen. For more information, please follow other related articles on the PHP Chinese website!