验证码php函数
<code> function verifyImg($width=80,$height=30){//定义画布$img=imagecreatetruecolor($width, $height);//定义颜色$white=imagecolorallocate($img, 255, 255, 255);$black=imagecolorallocate($img, 0, 0, 0);//画出画布imagefilledrectangle($img, 1, 1, $width-2, $height-2, $white);//写字$size=mt_rand(18,22);$angle=mt_rand(-3,3);$x=mt_rand(2,10);$y=mt_rand(20,28);$fontfiles='../font/simhei.ttf';$_SESSION['verify']=$str=randomStr();imagettftext($img, $size, $angle, $x, $y, $black,$fontfiles ,$str);//增加干扰点for($i=0;$i<100;$i++){ $x=mt_rand(1,$width-1); $y=mt_rand(1,$height-1); $red=mt_rand(1,150); $green=mt_rand(1,150); $blue=mt_rand(1,150); $color=imagecolorallocate($img, $red, $green, $blue); imagesetpixel($img, $x, $y, $color);}//生成图片header("content-type:image/gif");imagegif($img);imagedestroy($img);</code>请大神帮小弟看看是哪里出了问题了!
搞得我毫无头绪!
之前一直用得好好的,突然间就用不了了!
gd库是开了的啊!
”扩展PHP“说起来容易做起来难。PHP已经进化成一个日趋成熟的源码包几十兆大小的工具。要骇客如此复杂的一个系统,不得不学习和思考。构建本章内容时,我们最终选择了“在实战中学习”的方式。这不是最科学也不是最专业的方式,但是此方式最有趣,也得出了最好的最终结果。下面的部分,你将先快速的学习到,如何获得最基本的扩展,且这些扩展立即就可运行。然后你将学习到 Zend 的高级 API 功能,这种方式将不得
392
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号