Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

phpÑéÖ¤Âë´úÂëʵÀý

ÎÒÃÇÔÚдÓû§ÑéÖ¤Ò³Ã棬Èç×¢²á£¬µÇ¼µÄʱºò£¬ÎªÁ˼ÓÇ¿Óû§µÇ¼µÄ°²È«ÐÔ£¬Ìí¼ÓÑéÖ¤ÂëÑéÖ¤¡£
ÑéÖ¤Âëͨ¹ýGDÉú³ÉPNGͼƬ£¬²¢°Ñ$randvalËæ»úÊý×Ö¸³¸ø$_SESSION['login_check_num']£¬ÔÚͨ¹ýÓû§ÊäÈëµÄ$_POST½øÐбȽϣ¬À´ÅжÏÊÇ·ñÕýÈ·¡£´ïµ½ÐèҪʵÏֵŦÄÜ£¬ÐèÒªÐÞ¸Äphp.iniÎļþ£¬Ê¹phpÖ§³ÖGD¿â¡£
<?php
//µ÷ÓôËÒ³Ã棬Èç¹ûÏÂÃæµÄʽ×Ó³ÉÁ¢£¬ÔòÉú³ÉÑéÖ¤ÂëͼƬ
if($_GET["action"]=="verifycode")
{
    rand_create();
}
//ÑéÖ¤ÂëͼƬÉú³É
function rand_create()
{
    //֪ͨä¯ÀÀÆ÷½«ÒªÊä³öPNGͼƬ
    Header("Content-type: image/PNG");
    //×¼±¸ºÃËæ»úÊý·¢ÉúÆ÷ÖÖ×Ó
    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["login_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);
}
//¼ìÑéÑéÖ¤Âë
function rand_check()
{
    if($_POST["reg_rand"] == $_SE


Ïà¹ØÎĵµ£º

¶À¼Ò£º¿ª·¢Õß²»¿É²»ÖªµÄPHP¿ò¼ÜÉî¶È½âÎö


2009-08-03 16:05
 | 
6456´ÎÔĶÁ
 | 
¡¾ÒÑÓÐ2
ÌõÆÀÂÛ¡¿·¢±íÆÀÂÛ
¹Ø¼ü´Ê£ºPHP

 | ¸Ðлydj9931
µÄÌṩ
 | 
ÊÕ²ØÕâƪÐÂÎÅ
¡¾Csdn
8ÔÂ3ÈÕ±¨µÀ¡¿PHP³ÉΪÊÀ½çÉÏ×îÁ÷ÐеĽű¾ÓïÑÔÓÐÐí¶àÔ­Òò£ºÁé»îÐÔ£¬Ò×ÓÃÐԵȵȡ£µ«Í¨³£Ö»ÓÃPHP»òÕßÆäËûÓïÑÔ±àÂë¾Í»áÏԵõ¥µ÷¡¢Öظ´£¬Õâ ......

php date()º¯Êý˵Ã÷

string date ( string format [, int timestamp] )     //ÆäÖÐtimestampΪ¿ÉÑ¡£¬Ä¬ÈÏֵΪtime();
date("1");    //Monday
date("m.d.y");   //12.21.09
date("m.d.Y");//12.21.2009
$tomorrow  = mktime(0, 0, 0, date("m")  , date("d")+1, date("Y"));
$las ......

PHPÕýÔò±í´ïʽÏê½â

½ñÌì»Ø¹ËÁËÏÂÕýÔòµÄ»ù±¾ÖªÊ¶¡£  ×ÜÈÝÒ×Íü£¬ÌؼÇÓÚ´Ë¡£
ÓÃÓÚÃèÊö×Ö·ûÅÅÁкÍÆ¥ÅäģʽµÄÒ»ÖÖÓï·¨¹æÔò¡£ËüÖ÷ÒªÓÃÓÚ×Ö·û´®µÄģʽ·Ö¸î¡¢Æ¥Åä¡¢²éÕÒ¼°Ìæ»»²Ù×÷¡£
PHPÖеÄÕýÔòº¯Êý£º
PHPÖÐÓÐÁ½Ì×ÕýÔòº¯Êý£¬Á½Õß¹¦Äܲ¶à£¬·Ö±ðΪ£º
Ò»Ì×ÊÇÓÉPCRE£¨Perl Compatible Regular Expression£©¿âÌṩµÄ¡£Ê¹ÓÓpreg_” ......

phpµÄ°²×°Óëµ÷ÊÔ

1.°Ñ½âѹµÄphp-5.2.6-Win32.zipÖØÃüÃûΪphp5¡£²¢¸´ÖƵ½DÅÌĿ¼Ï¡£¼´°²×°Â·¾¶Îª D:\php5
2.ÕÒµ½phpĿ¼Ï嵀 php.ini-dist»ò php.ini.recommendedÎļþ£¬ÖØÃüÃûΪ php.ini
3.ÔÙ°ÑphpĿ¼ÏµÄphp5ts.dll,libmysql.dll¸´ÖƵ½Ä¿Â¼ c:\windows\system32Ï¡£
4.°Ñphp5\extĿ¼ÏµÄphp_gd2.dll,php_mysql.dll,php_mbstring.dllÎ ......

PHPÊÇ×îºÃµÄÍøÕ¾¿ª·¢ÓïÑÔ

×÷Ϊһ¸öȫеĻ¥ÁªÍøÏîÄ¿£¬ÓÐʱºò»áÃæÁÙÒ»¸öÑ¡ÔñʲôÑùµÄ¿ª·¢ÓïÑÔµÄÎÊÌâ¡£
ÎÒ˵µÄÕâ¸öÓÐʱºò£¬ÆäʵÊÇÖ¸ÏÖÓеÄÍŶÓÖУ¬Ã»Óм¼Êõ¿ª·¢µÄ³ÉÔ±µÄÇé¿ö¡£Èç¹ûÒѾ­ÓÐÁËÒ»¸ö»òÕ߶à¸ö¼¼Êõ¿ª·¢ÈËÔ±£¬µ±È»ÊÇÑ¡ÔñÏÖÓгÉÔ±×îÊìϤºÍ×îÉó¤µÄÓïÑÔÁË¡£
ÄÇô¶ÔÓÚÒ»¸ö»¹Ã»Óм¼Êõ³ÉÔ±µÄÍŶӣ¬Ó¦¸ÃÑ¡ÔñʲôÑùµÄ¿ª·¢ÓïÑÔÄØ£¿»Ø´ðÕâ¸öÎÊÌ⣬Ê×Ï ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ