為什么這段代碼在wamp中使用不了 生成圖形驗(yàn)證碼呢<?php
$img?=?imagecreatetruecolor(100,?40);
$black?=?imagecolorallocate($img,?0x00,?0x00,?0x00);
$green?=?imagecolorallocate($img,?0x00,?0xFF,?0x00);
$white?=?imagecolorallocate($img,?0xFF,?0xFF,?0xFF);
imagefill($img,0,0,$white);
//生成隨機(jī)的驗(yàn)證碼
$code?=?'';
for($i?=?0;?$i?<?4;?$i++)?{
????$code?.=?rand(0,?9);
}
imagestring($img,?5,?10,?10,?$code,?$black);
//加入噪點(diǎn)干擾
for($i=0;$i<50;$i++)?{
??imagesetpixel($img,?rand(0,?100)?,?rand(0,?100)?,?$black);?
??imagesetpixel($img,?rand(0,?100)?,?rand(0,?100)?,?$green);
}
//輸出驗(yàn)證碼
header("content-type:?image/png");
imagepng($img);
imagedestroy($img);
在wamp怎么使用這段代碼實(shí)現(xiàn)圖形驗(yàn)證碼?
qq_desperado_0
2016-07-01 14:51:42