Home > Article > Backend Development > 用php生成一张图片,但是显示不出来
php
session_start();
for($i=0;$i$_nmsg.= dechex(mt_rand(0,15));
}
$_SESSION['code']=$_nmsg;
$_width=75;
$_height=25;
$_img=imagecreatetruecolor($_width,$_height);
$_white=imagecolorallocate($_img,255,255,255);
imagefill($_img,0,0,$_white);
header('Content-Type:image/png');
imagepng($_img);
imagedestroy($_img);
?>