Cuando hago una imagen de código de verificación PHP, no importa en qué número cambie ($im,0,0,0), el fondo siempre es negro. El código es el siguiente.
Usa mi código
/*Implementación de la imagen del código de verificación*/
session_start( );
//1, crear lienzo
$image=imagecreate(100,40);
//2. Definir color
$background=imagecolorallocate($image,200,255,255);//color de fondo
$text_color=imagecolorallocate($image,255, 125,125);//font_color
$yansucolor=imagecolorallocate($image,255,0,0);//snowflake_color
//3.
Rellena el lienzo con color
imagefill($image,0,0,$ background);
//4. Agrega elementos de interferencia al lienzo
para ($ i=1;$i { $x=rand(0,90); $ y= rand(0,40); Agregar copos de nieve imagesetpixel($image,$x,$y,$yansucolor); } p> imagenline($image,20,0,80,10,$yansucolor); línea de imagen ($imagen,0,0,80,40,$yansucolor); línea de imagen($imagen,0,20,40,40,$yansucolor); p> /5. Llena el lienzo con contenido $arr=array("A", "B",9, "C", "D", "E", "F" ,3, "G", "H", "I", "J", "K",8, "L", "M", "N", "O",1, "P", "Q" , "R ", "S", "T", "U", "2, "V", "W", "X", "Y", "Z", "a", "b",7, "c", "d", "e", "f", "g",4 , "h", "i", "j", "k", "l", "m", "n", "o", "p", "q",6, "r", "s", "t", "u", "v",5, "w", "x", "y", "z ",0 ); for($j=0;$j<6;$j++) { $ num=rand(0,15 ); $str=$str.$arr[$num] } $_SESSION[yzm]=$str; $angle=rand(0,20);//ángulo de inclinación imagettftext($ image,20,$angel,10,30,$text_color, "Greek_i.ttf",$str) ; p> //$num=rand(1000,9999); //Declarar al sistema header(" Content-type. image/png"); //convierte el archivo php a imagen imagepng($image); //libera recursos p> destruccióndeimagen($imagen> );