PHP³ÌÐòÔ±×îÒ×·¸10ÖÖ´íÎó
1.²»×ªÒâhtml entities
Ò»¸ö»ù±¾µÄ³£Ê¶£ºËùÓв»¿ÉÐÅÈεÄÊäÈ루ÌرðÊÇÓû§´ÓformÖÐÌá½»µÄÊý¾Ý£© £¬Êä³ö֮ǰ¶¼Òª×ªÒâ¡£
echo $_GET['usename'] ;
Õâ¸öÀý×ÓÓпÉÄÜÊä³ö£º
<scrīpt>/*¸ü¸ÄadminÃÜÂëµÄ½Å±¾»òÉèÖÃcookieµÄ½Å±¾*/</scrīpt>
ÕâÊÇÒ»¸öÃ÷ÏԵݲȫÒþ»¼£¬³ý·ÇÄã±£Ö¤ÄãµÄÓû§¶¼ÕýÈ·µÄÊäÈë¡£
ÈçºÎÐÞ¸´ £º
ÎÒÃÇÐèÒª½«"< ",">","and" µÈת»»³ÉÕýÈ·µÄHTML±íʾ(< , >', and ")£¬º¯Êýhtmlspecialchars ºÍ htmlentities()ÕýÊǸÉÕâ¸ö»îµÄ¡£
ÕýÈ·µÄ·½·¨£º
echo htmlspecialchars($_GET['username'], ENT_QUOTES);
2. ²»×ªÒâSQLÊäÈë
ÎÒÔø¾ÔÚһƪÎÄÕÂÖÐ×î¼òµ¥µÄ·ÀÖ¹sql×¢ÈëµÄ·½·¨(php+mysqlÖÐ)ÌÖÂÛ¹ýÕâ¸öÎÊÌâ²¢¸ø³öÁËÒ»¸ö¼òµ¥µÄ·½·¨¡£ÓÐÈ˶ÔÎÒ˵£¬ËûÃÇÒѾÔÚphp.ini
Öн«magic_quotesÉèÖÃΪOn£¬ËùÒÔ²»±Øµ£ÐÄÕâ¸öÎÊÌ⣬µ«ÊDz»ÊÇËùÓеÄÊäÈ붼ÊÇ´Ó$_GET, $_POST»ò $_COOKIEÖеĵõ½µÄ£¡
ÈçºÎÐÞ¸´£º
ºÍÔÚ×î¼òµ¥µÄ·ÀÖ¹sql×¢ÈëµÄ·½·¨(php+mysqlÖÐ)ÖÐÒ»ÑùÎÒ»¹ÊÇÍƼöʹÓÃmysql_real_escape_string()º¯Êý
ÕýÈ·×ö·¨£º
<?php
$sql = "UPDATE users SET
name='.mysql_real_escape_string($name).'
WHERE id='.mysql_real_escape_string ($id).'";
mysql_query($sql);
?>
3.´íÎóµÄʹÓÃHTTP-header Ïà¹ØµÄº¯Êý: header(), session_start(), setcookie()
Óöµ½¹ýÕâ¸ö¾¯¸æÂð?"warning: Cannot add header information - headers already sent [....]
ÿ´Î´Ó·þÎñÆ÷ÏÂÔØÒ»¸öÍøÒ³µÄʱºò£¬·þÎñÆ÷µÄÊä³ö¶¼·Ö³ÉÁ½¸ö²¿·Ö£ºÍ·²¿ºÍÕýÎÄ¡£
Í·²¿°üº¬ÁËһЩ·Ç¿ÉÊÓµÄÊý¾Ý£¬ÀýÈçcookie¡£Í·²¿×ÜÊÇÏȵ½´ï¡£ÕýÎIJ¿·Ö°üÀ¨¿ÉÊÓµÄhtml£¬Í¼Æ¬µÈÊý¾Ý¡£
Èç¹ûoutput_bufferingÉèÖÃΪOff£¬ËùÓеÄHTTP-headerÏà¹ØµÄº¯Êý±ØÐëÔÚÓÐÊä³ö֮ǰµ÷Óá£ÎÊÌâÔÚÓÚÄãÔÚÒ»¸ö»·¾³Öпª·¢£¬¶øÔÚ²¿
Êðµ½ÁíÒ»¸ö»·¾³ÖÐÈ¥µÄʱºò£¬output_bufferingµÄÉèÖÿÉÄܲ»Ò»Ñù¡£½á¹ûתÏòÍ£Ö¹ÁË£¬cookieºÍsession¶¼Ã»ÓÐÕýÈ·µÄÉè
ÖÃ........¡£
ÈçºÎÐÞ¸´:
È·±£ÔÚÊä³ö֮ǰµ÷ÓÃhttp-headerÏà¹ØµÄº¯Êý£¬²¢ÇÒÁîoutput_buffering = Off
¡£
4. Require »ò include µÄÎļþʹÓò»°²È«µÄÊý¾Ý
ÔÙ´ÎÇ¿µ÷£º²»ÒªÏàÐŲ»ÊÇÄã×Ô¼ºÏÔʽÉùÃ÷µÄÊý¾Ý¡£²»Òª Include »ò require ´Ó$_GET, $_POST »ò $_COOKIE Öеõ½µÄÎļþ¡£
ÀýÈç:
index.php
<?
//including header, config, database connection, etc
include(
Ïà¹ØÎĵµ£º
1.ÓÃ;:
·þÎñÆ÷¿ÉÒÔÀûÓÃCookies°üº¬ÐÅÏ¢µÄÈÎÒâÐÔÀ´É¸Ñ¡²¢¾³£ÐÔά»¤ÕâЩÐÅÏ¢£¬ÒÔÅжÏÔÚHTTP´«ÊäÖеÄ״̬¡£Cookies×îµäÐ͵ÄÓ¦ÓÃÊÇÅж¨×¢²áÓû§ÊÇ·ñÒѾµÇ¼ÍøÕ¾£¬Óû§¿ÉÄÜ»áµÃµ½Ìáʾ£¬ÊÇ·ñÔÚÏÂÒ»´Î½øÈë´ËÍøվʱ±£ÁôÓû§ÐÅÏ¢ÒÔ±ã¼ò»¯µÇ¼ÊÖÐø£¬ÕâЩ¶¼ÊÇCookiesµÄ¹¦Óá£ÁíÒ»¸öÖØÒ ......
Ê×Ïȼì²éһϵݲװ°ü£º
rpm -q gd
rpm -q
jpegsrc
rpm -q libpng
rpm -q zlib
rpm -q freetype
Èç¹ûÒÔÉϵݲװ°üûÓУ¬Çë×ÔÐа²×°£¬ÆäʵҪֻҪgd ºÍlibpn Ïà¹ØµÄ°ü¼´¿É£¬ÆäËûµÄΪÁËÖ§³ÖÆäËûͼÐθñʽ¶øÒÑ¡£
£¨ÒÔϵݲװ²½ÖèΪÕûÀí×ÔÍøÂçÎÄÕ£©
1.°²×°zlib
tar zxvf zlib-1.2.2. ......
Memcacheº¯Êý¿âÊÇÔÚ PECL(PHP Extension Community Library)ÖУ¬Ö÷Òª×÷ÓÃÊǴ´óÈÝÁ¿µÄÄÚ´æÊý¾ÝµÄÁÙʱ´æ·ÅÇøÓò£¬ÔÚ·Ö²¼Ê½µÄʱºò×÷ÓÃÌåÏֵķdz£Ã÷ÏÔ£¬·ñÔò²»½¨ÒéʹÓá£
Memcache Win32 µÄ°²×°ºÍPHPÖеÄÅäÖÃ
ÏÂÔØ£ºMemcache Win32
www.php100.com www.jehiah.cz/projects/memcached-win32/
1¡¢½âѹµ½Ä¿Â¼£º ......
GoogleΪȫÇòÖ÷Òª³ÇÊÐÌṩÁËͳһµÄÌìÆøÔ¤±¨Êý¾Ý´æ´¢¸ñʽ£¬ÄǾÍÊÇXML¡£ËùÓеĿª·¢Õ߶¼¿ÉÒÔÀûÓÃ×Ô¼ºÏ²»¶µÄÓïÑÔÀ´½âÎöXML»ñÈ¡ËùÐè³ÇÊеÄÌìÆøÔ¤±¨£¬±¾ÎĽ«½éÉÜÀûÓÃPHPÀ´»ñÈ¡ÎÒËùÔÚ³ÇÊмÃÄϵÄÌìÆøÔ¤±¨¡£
ÔÎļû±¾ÈËÍøÕ¾¡¾PHP̽·Õß¡¿
ÔÎÄÁ´½Ó£º
PHP5 ¶ÁÈ¡Google ÌìÆøÔ¤±¨XML API ......