ÓÃPHPÉú³ÉÑéÖ¤Âë¿ÉÒÔ½øÐеã»÷Ë¢ÐÂ
ÑéÖ¤ÂëµÄ´óÖÂÔÀíÊÇÕâÑùµÄ£¬Ê×ÏÈÉú³ÉÒ»¸öËæ»úÊý£¬È»ºóÔÚÊý¾ÝÊýÉÏÃæ¼ÓÉϸÉÈÅͼƬ£¬Í¬Ê±°Ñ¸ÃÊý¾ÝÉú³ÉͼƬ²¢Êä³ö¡£
Õâ¸öÊý¾Ý±£´æÔÚsessionÖС£È»ºó°ÑÓû§µÄÊäÈëÓë±£´æÔÚsessionÖеÄÊý¾Ý½øÐÐÆ¥Å䣬½øÐÐÑéÖ¤¡£
verifyCode.php´úÂëÈçÏ£º
<?php
Header("Content-type: image/PNG");
session_start();
//×¼±¸ºÃËæ»úÊý·¢ÉúÆ÷ÖÖ×Ó
srand((double)microtime()*1000000);
//×¼±¸Í¼Æ¬µÄÏà¹Ø²ÎÊý
$im = imagecreate(62,20);
$black = ImageColorAllocate($im, 0,0,0); //RGBºÚÉ«±êʶ·û
$white = ImageColorAllocate($im, 255,255,255); //RGB°×É«±êʶ·û
$gray = ImageColorAllocate($im, 200,200,200); //RGB»ÒÉ«±êʶ·û
//¿ªÊ¼×÷ͼ
imagefill($im,0,0,$gray);
while(($randval=rand()%100000)<10000);
{
$_SESSION["check_num"] = $randval;
//½«ËÄλÕûÊýÑéÖ¤Âë»æÈëͼƬ
imagestring($im, 5, 10, 3, $randval, $black);
}
//¼ÓÈë¸ÉÈÅÏóËØ
for($i=0;$i<200;$i++){
$randcolor = ImageColorallocate($im,rand(0,255),rand(0,255),rand(0,255));
imagesetpixel($im, rand()%70 , rand()%30 , $randcolor);
}
//Êä³öÑé֤ͼƬ
ImagePNG($im);
//Ïú»ÙͼÏñ±êʶ·û
ImageDestroy($im);
//header("content-type:image/png");
////¶¨Òåheader£¬ÉùÃ÷ͼƬÎļþ£¬×îºÃÊÇpng£¬ÎÞ°æÈ¨Ö®ÈÅ;
////Éú³ÉеÄËÄλÕûÊýÑéÖ¤Âë
//session_start();//¿ªÆôsession;
//$authnum_session = '';
//$str = 'abcdefghijkmnpqrstuvwxyz1234567890';
////¶¨ÒåÓÃÀ´ÏÔʾÔÚͼƬÉϵÄÊý×ÖºÍ×Öĸ;
//$l = strlen(str); //µÃµ½×Ö´®µÄ³¤¶È;
////Ñ»·Ëæ»ú³éÈ¡ËÄÎ»Ç°Ãæ¶¨ÒåµÄ×ÖĸºÍÊý×Ö;
//for($i=1;$i<=4;$i++)
//{
//$num=rand(0,l-1);
////ÿ´ÎËæ»ú³éȡһλÊý×Ö;´ÓµÚÒ»¸ö×Öµ½¸Ã×Ö´®×î´ó³¤¶È,
////¼õ1ÊÇÒòΪ½ØÈ¡×Ö·ûÊÇ´Ó0¿ªÊ¼ÆðËã;ÕâÑù34×Ö·ûÈÎÒâ¶¼ÓпÉÄÜÅÅÔÚÆäÖÐ;
//$authnum_session.= str($num);
////½«Í¨¹ýÊý×ÖµÃÀ´µÄ×Ö·ûÁ¬ÆðÀ´Ò»¹²ÊÇËÄλ;
//}
//session_register("authnum_session");
////ÓÃsessionÀ´×öÑéÖ¤Ò²²»´í;×¢²ásession,Ãû³ÆÎªauthnum_session,
////ÆäËüÒ³ÃæÖ»Òª°üº¬Á˸ÃͼƬ
////¼´¿ÉÒÔͨ¹ý_session["authnum_session"]À´µ÷ÓÃ
Ïà¹ØÎĵµ£º
À´Ô´ÓÚ£ºhttp://news.csdn.net/a/20100205/216909.html
¾Ý¡¶Å¦Ô¼Ê±±¨¡·ÍøÕ¾±¨µÀ
£¬¶ÁÐ´Íø¼ÇÕßÓëPHPµÄ´´ÔìÕßRasmus LerdorfÁªÏµ£¬Ñ¯ÎÊËû¶ÔFacebook¸Õ¸Õ¿ªÔ´µÄPHPÓÅ»¯ÏîÄ¿HipHopÓкο´·¨¡£LerdorfÔÚÓʼþÖÐ˵£¬ÕâÊÇÒ»¸öºÜ¿áµÄÏîÄ¿£¬¿Ï¶¨»á³ÉÎªÄ³Ð©ÍøÕ¾ºÜºÃµÄÑ¡Ôñ¡£
µ«ÊÇ£¬Ëû½ÓÏÂÀ´Ëµ£¬¶ÔÓÚÐí¶àWebÓ¦ÓÃÀ´Ëµ£¬Ö´ÐÐËٶȲ¢²»ÊÇÖ ......
Ò»£®Ê×ÏÈÊÇPHP ÍøÒ³µÄ±àÂë
1.phpÎļþ±¾ÉíµÄ±àÂëÓëÍøÒ³µÄ±àÂëӦƥÅä
a. Èç¹ûÓûʹÓÃgb2312±àÂ룬ÄÇôphpÒªÊä³öÍ·£ºheader(“Content-Type: text/html; charset=gb2312")£¬¾²Ì¬Ò³ÃæÌí¼Ó<meta http-equiv="Content-Type" content="text/html; charset=gb2312">£¬ËùÓÐÎļþµÄ±àÂë¸ñʽΪANS ......
»¥ÁªÍøµÄ½ñÌ죬AJAXÒѾ²»ÊÇʲôİÉúµÄ´Ê»ãÁË¡£ËµÆðAJAX£¬¿ÉÄÜ»áÁ¢¼´ÏëÆðÒòRSS¶øÐËÆðµÄXML¡£XMLµÄ½âÎö£¬¿ÖÅÂÒѾ²»ÊÇʲôÄÑÌâÁË£¬ÌرðÊÇPHP5£¬´óÁ¿µÄXML½âÎöÆ÷µÄÓ¿ÏÖ£¬Èç×îÇáÁ¿¼¶µÄSimpleXML¡£²»¹ý¶ÔÓÚAJAXÀ´Ëµ£¬XMLµÄ½âÎö¸üÇãÏòÓÚǰ̨JavascriptµÄÖ§³Ö¶È¡£ÎÒÏëËùÓнâÎö¹ýXMLµÄÈË£¬¶¼»áÒòÊ÷ºÍ½Úµã¶øÍ·´ó¡£²»¿É·ñÈÏ£¬XMLÊÇºÜ ......
4.1 ¿é×¢ÊÍ
¿é×¢ÊÍͨ³£ÓÃÓÚÌṩ¶ÔÎļþ£¬·½·¨£¬Êý¾Ý½á¹¹ºÍËã·¨µÄÃèÊö¡£¿é×¢Êͱ»ÖÃÓÚÿ¸öÎļþµÄ¿ªÊ¼´¦ÒÔ¼°Ã¿¸ö·½·¨Ö®Ç°¡£ËüÃÇÒ²¿ÉÒÔ±»ÓÃÓÚÆäËûµØ·½£¬±ÈÈç·½·¨ÄÚ²¿¡£ÔÚ¹¦Äܺͷ½·¨ÄÚ²¿µÄ¿é×¢ÊÍÓ¦¸ÃºÍËüÃÇËùÃèÊöµÄ´úÂë¾ßÓÐÒ»ÑùµÄËõ½ø¸ñʽ¡£
¿é×¢ÊÍÖ®Ê×Ó¦¸ÃÓÐÒ»¸ö¿ÕÐУ¬ÓÃÓÚ°Ñ¿é×¢ÊͺʹúÂë·Ö¸î¿ªÀ´£¬±ÈÈ磺
/*
* ÕâÀïÊÇ¿é×¢ÊÍ ......
PHP°²×°ÅäÖÃ˵Ã÷
Ò»¡¢Èí¼þÏÂÔØ
PHP5.3.0:http://cn2.php.net/get/php-5.3.0.tar.gz/from/this/mirror
Pear£ºhttp://de.pear.php.net/get/PEAR-1.9.0.tar
Mm£ºftp://ftp.ossp.org/pkg/lib/mm/mm-1.4.2.tar.gz
¶þ¡¢»·¾³¼ì²é
ÒѰ²×°Apache2.2.13(/usr/local/apache/),mm-1.4.2£¨/usr/local/mm/£©
rpm -qa|grep mcrypt ......