PHPÀàµÄÊôÐÔ·ÃÎÊÆ÷·½·¨
µ±´æÈ¡Ò»¸öÀàµÄ²»´æÔÚµÄÊôÐÔʱ£¬½âÎöÆ÷»áÅжÏÊÇ·ñÓÐÒÔÏÂÁ½¸öÊôÐÔ·ÃÎÊÆ÷·½·¨£º
__getºÍ__set¡£
Èç¹ûÓУ¬Ôò»á×Ô¶¯µ÷ÓÃÕâЩ·½·¨¡£Í¨¹ýÊôÐÔ·ÃÎÊÆ÷·½·¨¿ÉÒÔ¿ØÖƶÔÀàÊôÐԵķÃÎÊ£¬ÒÔʵÏÖ¶ÔÒª±£´æµÄÊý¾Ý½øÐмì²é£¬´Ó¶øÈ·±£ÊôÐÔÖµÓÐÒâÒåµÄÊý¾Ý¡£__get·½·¨Ö»ÓÐÒ»¸ö²ÎÊý£¬ÓÃÓÚ´«µÝÊôÐÔµÄÃû³Æ¡£__set·½·¨ÓÐÁ½¸ö²ÎÊý£¬·Ö±ðÓÃÓÚ´«µÝÊôÐÔµÄÃû³ÆºÍÖµ¡£
<?php
class user{
public function __set($name,$value){
echo "{$name}:{$value}.<br />\n";
}
public function __get($name){
return "{$name}:ÊôÐÔÖµÉÐδÉèÖã¡";
}
}
$user1 = new user();
$user1->username = "ÕÅÈý·á";
$user1->password = "123";
echo $user1->email;
?>
Ïà¹ØÎĵµ£º
Ïëµ½PHP²Ù×÷Êý×éʱºò£¬¸øÒ»¸öÊý×éÌí¼ÓÒ»¸öÊý×鵥Ԫʱºò¿ÉÒÔÓÐÁ½ÖÖ·½Ê½£º
1.
$arr = array();
$arr[] = '';
2.
$arr = array();
array_push($arr,'');
¸Õ×öÒ»¸ö100000´ÎµÄÑ»·²åÈ룬½á¹û»¹ÊǵÚÒ»ÖÖÒª¿ìһЩ£¡£¨Ñ»·²åÈëÊý×Ö£¬100000´Î£¬µÚÒ»ÖÖ0.04×óÓÒ£¬µÚ¶þÖÖ0.08Ãë×óÓÒ£© ......
×ªÔØÇë×¢Ã÷³ö´¦: http://www.zvv.cn/blog/show-101-1.html
¡¡¡¡Ç°Ð©Ìì·¢ÏÖͨ¹ýNotepad++µÄDBGP²å¼þ½áºÏPHPµÄxdebugÀ©Õ¹¿ÉÒÔʵÏÖPHPÎļþµ÷ÊÔ£¬Í¬Ê±£¬½éÉÜ˵°üº¬Á˵¥²½µ÷ÊÔ¡¢¼àÊÓ±äÁ¿»¹Óпç Îļþµ÷ÊÔ¡£°´ÕÕÍøÂçÉϵÄ×ÊÁÏÅäÖúõ÷ÊÔ»·¾³ºóʵ¼ÊÊÔÓÃÁË·¢ÏÖ¹¦ÄܽÏΪ¼òª£¬µ¥Îļþµ÷ÊÔ»¹¿É£¬Èç¹ûÊÇ¿çÎļþµ÷ÊÔÏîÄ¿¾Í²»ÄÇÃ´Êæ·þÁË£¬ ......
$username = "root";
$password = "123";
// ½¨Á¢Á¬½Ó
mysql_connect('localhost', $username, $p ......
¡¡¡¡¶Ô±ÈÆð Cookie£¬Session ÊÇ´æ´¢ÔÚ·þÎñÆ÷¶ËµÄ»á»°£¬Ïà¶Ô°²È«£¬²¢ÇÒ²»Ïñ Cookie ÄÇÑùÓд洢³¤¶ÈÏÞÖÆ£¬±¾Îļòµ¥½éÉÜ Session µÄʹÓá£
¡¡¡¡ÓÉÓÚ Session ÊÇÒÔÎı¾ÎļþÐÎʽ´æ´¢ÔÚ·þÎñÆ÷¶ËµÄ£¬ËùÒÔ²»Å¿ͻ§¶ËÐÞ¸Ä Session ÄÚÈÝ¡£Êµ¼ÊÉÏÔÚ·þÎñÆ÷¶ËµÄ Session Îļþ£¬PHP ×Ô¶¯ÐÞ¸Ä Session ÎļþµÄȨÏÞ£¬Ö»±£ÁôÁËϵͳ¶ÁºÍдȨ ......
µ±Ç°ÍøÖ·ÊÇä¯ÀÀÆ÷ÀíÏÔʾµÄÍøÖ·£¬ÊÇÓû§¿´µ½µÄ¡£
¸ù·¾¶ÊÇphpÎļþÔÚ·þÎñÆ÷ÉϵÄ·¾¶£¬ÊÇÕæÊµµÄÎļþ·¾¶¡£
(ÓëjavaÊDz»Ò»ÑùµÄ)
Èç¹ûÓжà²ãincludeÓï¾ä£¬±ØÐëÓøù·¾¶£¬·ñÔò³ö´í¡£
Ìá½»±íµ¥Ê±ÒªÌá½»µ½µ±Ç°ÍøÖ·µÄÏà¶Ô»òÕß¾ø¶ÔµÄÍøÖ·ÀïÃæ¡£
---------------------------------------------------------------------
Ò»¸öÊÇÍ ......