PHPÖÐthis,self,parentµÄÇø±ð
{Ò»}PHPÖÐthis,self,parentµÄÇø±ðÖ®Ò»thisƪ
ÃæÏò¶ÔÏó±à³Ì(OOP,Object Oriented Programming)ÏÖÒѾ³ÉΪ±à³ÌÈËÔ±µÄÒ»Ïî»ù±¾¼¼ÄÜ¡£ÀûÓÃOOPµÄ˼Ïë½øÐÐPHPµÄ¸ß¼¶±à³Ì£¬¶ÔÓÚÌá¸ßPHP±à³ÌÄÜÁ¦ºÍ¹æ»®web¿ª·¢¹¹¼Ü¶¼ÊǺÜÓÐÒâÒåµÄ¡£
PHP5¾¹ýÖØдºó£¬¶ÔOOPµÄÖ§³Ö¶îÓÐÁ˺ܴóµÄ·ÉÔ¾£¬³ÉΪÁ˾߱¸Á˴󲿷ÖÃæÏò¶ÔÏóÓïÑÔµÄÌØÐÔµÄÓïÑÔ£¬±ÈPHP4ÓÐÁ˺ܶàµÄÃæÏò¶ÔÏóµÄÌØÐÔ¡£ÕâÀïÎÒÖ÷Ҫ̸µÄÊÇ this,self,parent Èý¸ö¹Ø¼ü×ÖÖ®¼äµÄÇø±ð¡£´Ó×ÖÃæÉÏÀ´Àí½â£¬·Ö±ðÊÇÖ¸ Õâ¡¢×Ô¼º¡¢¸¸Çס£Ïȳõ²½½âÊÍһϣ¬thisÊÇÖ¸Ïòµ±Ç°¶ÔÏóµÄÖ¸Õ루¿ÉÒÔ¿´³ÉCÀïÃæµÄÖ¸Õ룩£¬selfÊÇÖ¸Ïòµ±Ç°ÀàµÄÖ¸Õ룬parentÊÇÖ¸Ïò¸¸ÀàµÄÖ¸Õë¡£ÎÒÃÇÕâÀïƵ·±Ê¹ÓÃÖ¸ÕëÀ´ÃèÊö£¬ÊÇÒòΪûÓиüºÃµÄÓïÑÔÀ´±í´ï¡£¹ØÓÚÖ¸ÕëµÄ¸ÅÄ´ó¼Ò¿ÉÒÔÈ¥²Î¿¼°Ù¿Æ¡£
ÏÂÃæÎÒÃǾ͸ù¾Ýʵ¼ÊµÄÀý×Ó½áºÏÀ´½²½²¡£
<?php
class name //½¨Á¢ÁËÒ»¸öÃûΪnameµÄÀà
{
private $name; //¶¨ÒåÊôÐÔ£¬Ë½ÓÐ
//¶¨Òå¹¹Ô캯Êý£¬ÓÃÓÚ³õʼ»¯¸³Öµ
function __construct( $name )
{
$this->name = $name; //ÕâÀïÒѾʹÓÃÁËthisÖ¸Õë Óï¾ä¢Ù
}
//Îö¹¹º¯Êý
function __destruct(){}
//´òÓ¡Óû§Ãû³ÉÔ±º¯Êý
function printname()
{
print( $this->name ); //ÔÙ´ÎʹÓÃÁËthisÖ¸Õë Óï¾ä¢Ú£¬Ò²¿ÉÒÔʹÓÃechoÊä³ö
}
}
$obj1 = new name( "PBPHome" ); //ʵÀý»¯¶ÔÏó Óï¾ä¢Û
//Ö´ÐдòÓ¡
$obj1->printname(); //Êä³ö: PBPHome
echo "<br>"; &nbs
Ïà¹ØÎĵµ£º
ÔÚ·ÃÎÊPHPÀàÖеijÉÔ±±äÁ¿»ò·½·¨Ê±£¬Èç¹û±»ÒýÓõıäÁ¿»òÕß·½·¨±»ÉùÃ÷³Éconst»òÕßstatic,ÄÇô¾Í±ØÐëʹÓòÙ×÷·û::,·´Ö®Èç¹û±»ÒýÓõıäÁ¿»òÕß·½·¨Ã»Óб»ÉùÃ÷³Éconst»òÕßstatic,ÄÇô¾Í±ØÐëʹÓòÙ×÷·û->¡£
ÁíÍ⣬Èç¹û´ÓÀàµÄÄÚ²¿·ÃÎÊconst»òÕßstatic±äÁ¿»òÕß·½·¨,ÄÇô¾Í±ØÐëʹÓÃ×ÔÒýÓõÄself£¬·´Ö®Èç¹û´ÓÀàµÄÄÚ²¿·ÃÎʲ»Îªcons ......
µ±´æÈ¡Ò»¸öÀàµÄ²»´æÔÚµÄÊôÐÔʱ£¬½âÎöÆ÷»áÅжÏÊÇ·ñÓÐÒÔÏÂÁ½¸öÊôÐÔ·ÃÎÊÆ÷·½·¨£º
__getºÍ__set¡£
Èç¹ûÓУ¬Ôò»á×Ô¶¯µ÷ÓÃÕâЩ·½·¨¡£Í¨¹ýÊôÐÔ·ÃÎÊÆ÷·½·¨¿ÉÒÔ¿ØÖƶÔÀàÊôÐԵķÃÎÊ£¬ÒÔʵÏÖ¶ÔÒª±£´æµÄÊý¾Ý½øÐмì²é£¬´Ó¶øÈ·±£ÊôÐÔÖµÓÐÒâÒåµÄÊý¾Ý¡£__get·½·¨Ö»ÓÐÒ»¸ö²ÎÊý£¬ÓÃÓÚ´«µÝÊôÐÔµÄÃû³Æ¡£__set·½·¨ÓÐÁ½¸ö²ÎÊý£¬·Ö±ðÓÃÓÚ´«µÝÊôÐÔ ......
ÀࣨClass£©£ºÊÇһЩ±äÁ¿ÓëһЩʹÓÃÕâЩ±äÁ¿µÄº¯ÊýµÄ¼¯ºÏ¡£
¿É¼òµ¥Àí½âΪº¯ÊýºÍ±äÁ¿µÄ¼¯ºÏ£¬»ò±äÁ¿ºÍº¯ÊýµÄ¶¨ÒåµÄ¼¯ºÏ¡£
Óï·¨ÊÇ£º
class Class_name //Ï°¹ßÉÏÀàµÄµÚÒ»¸ö×Ö·ûΪ´óд£¬²¢ÇÒ±ØÐë·ûºÏ±äÁ¿µÄÃüÃû¹æÔò¡£
{
//º¯ÊýÓë±äÁ¿µÄ¼¯ºÏ(һЩ±äÁ¿(Àà³ÉÔ±)ºÍº¯Êý(ÐÐΪ·½·¨)µÄ¶¨Òå)¡£
}
Êý¾Ý³ÉÔ±(±äÁ¿)ÔÚÀ ......
×î½üÒ»Ö±ÔÚ×ö×Ô¼ºµÄͼÊéÕ¾£¬·Ö±ðʹÓùý½ÜÆæºÍ¶Á°ÉÁ½Ìײ»Í¬µÄϵͳ£¬¶ÔÓÚÕâÁ½Ì×ϵͳҲÊÇÓÖ°®ÓÖºÞ£¬°®µÄÊÇËûÃǵŦÄÜÇ¿´ó£¬ºÞËûÃǶ¼Í¬ÊôûÓпªÔ´¾«ÉñµÄ²úÎï¡£ºÇºÇ£¬×÷ΪһÃûÇî³ÌÐòÔ±£¬°³¿ÉÒÔÀí½â×÷ÕߵĿàÖÔ£¬ÕâÀï¾Í²»ÅúÅÐÁË¡£
Äê¼ÙÆڼ䣬ÎÞÊ¿É×ö£¬·¿´×Ô¼ºÒÔÇ°µÄ²É¼¯´úÂ룬·¢Ïֺܶà¿ÉÒÔÓÅ»¯ºÍÌáÉýµÄµØ·½£¬¾Í¼òµ¥×öÁËÏÂÓÅ» ......
ÊÜÓ°Ïìϵͳ£º
PHP PHP 5.2.x
²»ÊÜÓ°Ïìϵͳ£º
PHP PHP 5.2.11
ÃèÊö£º
BUGTRAQ ID: 36449
CVE ID: CVE-2009-3291,CVE-2009-3292,CVE-2009-3293,CVE-2009-3294
PHPÊǹ㷺ʹÓõÄͨÓÃÄ¿µÄ½Å±¾ÓïÑÔ£¬ÌرðÊʺÏÓÚWeb¿ª·¢£¬¿ÉǶÈëµ½HTMLÖС£
PHPµÄ5.2.11֮ǰ°æ±¾µÄ¶à¸öº¯ÊýÖдæÔÚ°²È«Â©¶´£¬¿ÉÄÜÔÊÐíÔ¶³Ì¹¥»÷Õßµ¼ ......