½Ð°Ýµ{¦¡¦p¦ó¿ëÃѹϧÎÅçÃÒ½X
- ©«¤l
- 2
- ¥DÃD
- 2
- ºëµØ
- 0
- ¿n¤À
- 8
- ÂI¦W
- 0
- §@·~¨t²Î
- Windows
- ³nÅ骩¥»
- 7
- ¾\ŪÅv
- 10
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2014-1-14
- ³Ì«áµn¿ý
- 2017-2-15
|
½Ð°Ýµ{¦¡¦p¦ó¿ëÃѹϧÎÅçÃÒ½X
½Ð°Ý¦U¦ì¤j¤j
¦³«Ü¦hºô¶¡A»Ýn¿é¤J¹Ï§Î¸ÌªºªºÅçÃÒ½X¡A¤~¯à¶i¤J¤U¤@¨B
«ç»òÅýµ{¦¡¦Û°Ê¿ëÃѳo¨Ç¹Ï§Î¸Ìªº¼Æ¦r»P¤å¦r? |
|
|
|
|
|
|
- ©«¤l
- 11
- ¥DÃD
- 2
- ºëµØ
- 0
- ¿n¤À
- 50
- ÂI¦W
- 0
- §@·~¨t²Î
- windows
- ³nÅ骩¥»
- office2003
- ¾\ŪÅv
- 20
- ©Ê§O
- ¤k
- ¨Ó¦Û
- ¤õ¬P
- µù¥U®É¶¡
- 2014-8-25
- ³Ì«áµn¿ý
- 2015-11-13
|
¥»©«³Ì«á¥Ñ momokt1515 ©ó 2015-3-30 17:43 ½s¿è
±z¦n:
§A¥H¤U³o¬q¸Ü¡B¤£¤ÓÀ´±zªº·N«ä
½Ð°Ý¦U¦ì¤j¤j
¦³«Ü¦hºô¶¡A»Ýn¿é¤J¹Ï§Î¸ÌªºªºÅçÃÒ½X¡A¤~¯à¶i¤J¤U¤@¨B
«ç»òÅýµ{¦¡¦Û°Ê¿ëÃѳo¨Ç¹Ï§Î¸Ìªº¼Æ¦r»P¤å¦r?
§A¬O»Ý¨D ¹Ï«¬ÅçÃÒ½Xªº»yªk?
ÁÙ¬On¯}¸Ñ¥Lªº»yªk?
³o¬OÅçÃÒªºcode
/////////////////////////////////////////////////////////////////
<?php
$CaptchaString = ""; //ÅçÃÒ½X¤å¦r
$CaptchaLength = 5; //ÅçÃÒ½Xªø«×
//²£¥Í¼Æ¦rÅçÃÒ½X
for($i=0; $i < $CaptchaLength; $i++)
$CaptchaString = $CaptchaString.rand(0,9);
session_start();
$_SESSION['CAPTCHA'] = $CaptchaString; //ÅçÃÒ½X¦s¤JSESSION¤º
Header("Content-type: image/PNG"); //«Å§i¿é¥X¬°PNG¼v¹³
$CaptchaWidth = 50; //ÅçÃÒ½X¼v¹³¼e«×
$CaptchaHeight = 15; //ÅçÃÒ½X¼v¹³°ª«×
//«Ø¥ß¼v¹³
$Captcha = ImageCreate($CaptchaWidth, $CaptchaHeight);
//³]©wI´ºÃC¦â¡A½d¨Ò¬O¬õ¦â
$BackgroundColor = ImageColorAllocate($Captcha, 255, 0, 0);
//³]©w¤å¦rÃC¦â¡A½d¨Ò¬O¶Â¦â
$FontColor = ImageColorAllocate($Captcha, 0, 0, 0);
//¼v¹³¶ñº¡I´ºÃC¦â
ImageFill($Captcha, 0, 0, $BackgroundColor);
//¼v¹³µe¤WÅçÃÒ½X
ImageString($Captcha, 20, 0, 0, $_SESSION['CAPTCHA'] , $FontColor);
//ÀH¾÷µe¤W200ÓÂI¡A°µ¬°Âø°T¥Î
for($i = 0; $i < 200; $i++) {
Imagesetpixel($Captcha, rand() % $CaptchaWidth , rand() % $CaptchaHeight , $FontColor);
}
//¿é¥XÅçÃÒ½X¼v¹³
ImagePNG($Captcha);
ImageDestroy($Captcha);
?>
///////////////////////////////////////////////////////////////// |
|
|
|
|
|
|