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

PHP³õѧÕßÍ·Í´µÄÊ®ËĸöÎÊÌâ

1.Ò³ÃæÖ®¼äÎÞ·¨´«µÝ±äÁ¿
get,post,sessionÔÚ×îеÄphp°æ±¾ÖÐ×Ô¶¯È«¾Ö±äÁ¿Êǹرյģ¬ËùÒÔÒª´ÓÉÏÒ»Ò³ÃæÈ¡µÃÌá½»¹ýÀ´µÃ±äÁ¿ÒªÊ¹ÓÃ$_GET['foo'],$_POST['foo'],$_SESSION['foo']À´µÃµ½¡£µ±È»Ò²¿ÉÒÔÐÞ¸Ä×Ô¶¯È«¾Ö±äÁ¿Îª¿ª(php.ini¸ÄΪregister_globals = On)£»¿¼Âǵ½¼æÈÝÐÔ£¬»¹ÊÇÇ¿ÆÈ×Ô¼ºÊìϤеÄд·¨±È½ÏºÃ¡£
 
2.Win32ÏÂapache2 ÓÃget·½·¨´«µÝÖÐÎIJÎÊý»á³ö´í
 ÀýÈ磺test.php?a=ÄãºÃ&b=ÄãÒ²ºÃ
´«µÝ²ÎÊýÊǻᵼÖÂÒ»¸öÄÚ²¿´íÎó
½â¾ö°ì·¨:"test.php?a=".urlencode(ÄãºÃ)."&b=".urlencode(ÄãÒ²ºÃ)
urlencode($myname)Ö÷ÒªÓÃÓÚÕýȷʶ±ðºº×Ö ¿Õ¸ñÒÔ¼°ÆäËûÌØÊâ×Ö·û¡£
 
3.win32ϵÄsession²»ÄÜÕý³£¹¤×÷
php.iniĬÈϵÄsession.save_path = /tmp  ÕâÏÔÈ»ÊÇlinuxϵÄÅäÖã¬win32ÏÂphpÎÞ·¨¶ÁдsessionÎļþµ¼ÖÂsessionÎÞ·¨Ê¹Ó㬰ÑËü¸Ä³ÉÒ»¸ö¾ø¶Ô·¾¶¾Í¿ÉÒÔÁË£¬ÀýÈçsession.save_path = c:windows emp ,Ò»°ãÕâ¸ö¹¤×÷ÔÚÅäÖÃphpÔÚwinµÄ°²×°»·¾³µÄʱºò¾ÍÓ¦¸Ã½â¾öµÄ¡£
 
4.ÏÔʾ´íÎóÐÅÏ¢
µ±php.iniµÄdisplay_errors = On²¢ÇÒerror_reporting = E_ALLʱ£¬½«ÏÔʾËùÓеĴíÎóºÍÌáʾ£¬µ÷ÊÔµÄʱºò×îºÃ´ò¿ªÒÔ±ã¾À´í¡£
 
5.¸ü¸Äphp.iniºóûÓб仯
Ò»°ãÒªÖØÆôÄãµÄWEB SERVER(apache IIS)¡£
 
6.header already sent
Õâ¸ö´íÎóͨ³£»áÔÚÄãʹÓÃHEADERµÄʱºò³öÏÖ£¬Ëû¿ÉÄÜÊǼ¸ÖÖÔ­Òò£º
        1,ÄãÔÚʹÓÃHEADERǰprint»òÕßechoÁË
        2.Ä㵱ǰÎļþÇ°ÃæÓпÕÐÐ
        3.Äã¿ÉÄÜINCLUDEÁËÒ»¸öÎļþ,
        4.¸ÃÎļþβ²¿ÓпÕÐлò  ÕßÊä³öÒ²»á³öÏÖÕâÖÖ´íÎó¡£
 
7.includeºÍrequireµÄÇø±ð 
1.include °üº¬Îļþ£¬Èç¹û¸ÃÎļþ²»´æÔÚ£¬Ëü»áÌáʾ,µ«ÊÇËü»á¼ÌÐøÍùÏÂÖ´ÐС£
2.require °üº¬Îļþ£¬Èç¹û¸ÄÎļþ²»´æÔÚ£¬»áÌáʾÖÂÃü´íÎ󣬲¢Í˳ö.
win32ƽ̨ÏÂËüÃǶ¼ÊÇÏȰüº¬ºóÖ´ÐС£
8.isset()ºÍempty()µÄÇø±ð
Ïàͬ£ºÁ½Õß¶¼ÊDzâÊÔ±äÁ¿ÓõÄ.
²»Í¬£ºisset()ÊDzâÊÔ±äÁ¿ÊÇ·ñ±»¸³Öµ
           empty()ÊDzâÊÔÒ»¸öÒѾ­±»¸³ÖµµÄ±äÁ¿ÊÇ·ñΪ¿Õ
Èç¹ûÒ»¸ö±äÁ¿Ã»±»¸³Öµ¾ÍÒýÓÃÔÚphpÀïÊDZ»ÔÊÐíµÄ,µ«»áÓÐnoticeÌáʾ£¬Èç¹ûÒ»¸ö±äÁ¿±»¸³¿ÕÖµ£¬$foo=""»òÕß$foo=0»òÕß $foo=false,ÄÇôempty($foo)·µ»ØÕ棬isset($foo)Ò²


Ïà¹ØÎĵµ£º

PHPµÄheader()תÏòʧ°ÜµÄÒ»¸öÔ­Òò

header()º¯ÊýÓÃÀ´×ªÏò(redirect page)ʱ£¬Èç¹ûµ÷ÓÃǰÓÐÊä³ö£¬±ÈÈçecho»òhtml±êÇ©£¬¾Í»áתÏòʧ°Ü¡£
Èç¹ûµ÷ÓÃǰÓпÕÐÐÒ²»áתÏòʧ°Ü¡£
»¹ÓÐÒ»¸öÔ­Òò£¬¾ÍÊÇ×¢ÒâÄãµÄphpÎļþµÄ×Ö·û±àÂë¡£ÎÒÓöµ½µÄÇé¿öÊÇ£¬µ±×Ö·û±àÂëΪUTF-8ʱ£¬×ªÏòʧ°Ü£¬¸ÄΪANSIʱ³É¹¦¡£¾ßÌåÔ­Òò²»Ã÷£¬½ö¹©²Î¿¼¡£ ......

[ת]phpÖж¨½ç·û<<<µÄ×÷ÓÃ


phpÖж¨½ç·û<<<µÄ×÷Óà - [phpÓï
ÑÔ
]
[Time:2009-08-18]
°æÈ¨ÉùÃ÷
£º×ªÔØÊ±ÇëÒÔ³¬Á´½ÓÐÎʽ±êÃ÷ÎÄÕÂԭʼ³ö´¦ºÍ×÷ÕßÐÅÏ¢¼°±¾ÉùÃ÷
ת×Ô:http://star210.blogbus.com/logs/44486135.html
ÒòΪPHPÊÇÒ»¸öWeb±à³ÌÓïÑÔ£¬ÔÚ±à³Ì¹ý³ÌÖÐÄÑÃâ»áÓöµ½ÓÃechoÀ´Êä³ö´ó¶ÎµÄhtmlºÍjavascript
½Å
±¾µÄÇé¿ö£¬Èç¹ûÓô«Í³µÄÊ ......

10 ¼þ£¨Ò²Ðí£©Äã²»Á˽â PHP µÄÊÂÇé

PHP
ÊÇÎÒÓùýµÄÓïÑÔÖУ¬×îÁîÈËÄÕ»ðµÄµ«Í¬Ê±Ò²ÊÇ×îÓÐȤµÄÓïÑÔ¡£ÎÒÖ®ËùÒÔ˵“ÁîÈËÄÕ»ð”Ö÷ÒªÊÇÒòΪº¯ÊýÃüÃû¼«Æä²»Ò»Ö¡£¾¡¹ÜÎÒÿÌì¶¼ÒªÓõ½ÕâЩº¯Êý£¬ÎÒ»¹ÊÇÒªÏë
һϓ¾¿¾¹ÊÇ str_pos »¹ÊÇ strpos£¿ÊÇ str_split »¹ÊÇ
strsplit£¿”¡£ÁíÒ»·½Ã棬ÓÐʱºò¿ÉÒÔÓÃÒ»Ðмòµ¥µÄ´úÂë¾ÍÄܽâ¾öÒ»¸öÄÑÌâ¡£
ÏÂÃæ ......

21¸öʵÓñãÀûµÄPHP´úÂë

1. PHP¿ÉÔĶÁËæ»ú×Ö·û´®
´Ë´úÂë
½«´´½¨Ò»¸ö¿ÉÔĶÁµÄ×Ö·û´®£¬Ê¹Æä¸ü½Ó½ü´ÊµäÖеĵ¥
´Ê£¬ÊµÓÃÇÒ¾ßÓÐÃÜÂëÑéÖ¤¹¦ÄÜ¡£
/**************
[email=*@length]*@length[/email] - length of random string (must be a
multiple of 2)
**************/
function readable_random_string($length = 6){
    $conso= ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ