PHPÀàµÄ¾«Ëõ¹éÄÉ
Ò»£º½á¹¹ºÍµ÷ÓÃ(ʵÀý»¯)£º
class className{} £¬µ÷Óãº$obj = new className();µ±ÀàÓй¹Ô캯Êýʱ£¬»¹Ó¦´«Èë²ÎÊý¡£Èç$obj = new className($v,$v2...);
¶þ£º¹¹Ô캯ÊýºÍÎö¹¹º¯Êý£º
1¡¢¹¹Ô캯ÊýÓÃÓÚ³õʼ»¯£ºÊ¹ÓÃ__construct()£¬¿É´ø²ÎÊý¡£
2¡¢µ«Îö¹¹º¯Êý²»ÄÜ´ø²ÎÊý£¨ÓÃÓÚÔÚÏúÈ¥Ò»¸öÀà֮ǰִÐÐһЩ²Ù×÷»ò¹¦ÄÜ£©¡£Îö¹¹º¯ÊýÓÃ__destruct()×öÃû³Æ¡£Ôڽű¾Ö´ÐнáÊøʱ£¬PHP»áÏúµôÄÚ´æÖеĶÔÏó£¬Òò´Ë¿É²»ÓÃÎöÔ캯Êý£¬µ«ÓÐЩ±ÈÈçCOOKIEµÈ£¬¾ÍÓ¦µ±ÒªÓô˺¯ÊýÏúµô¡£
֪ʶµã£ºÔÚPHP4ÖÐÒ²ÌṩÁ˹¹Ô캯Êý£¬µ«Ê¹ÓõÄÊÇÓëÀàͬÃûµÄÀà·½·¨£¬ÔÚPHP5ÈÔÄܼæÈÝÕâÖÖ×ö·¨£¬µ±Ò»¸öÀàÖÐûÓаüº¬__constructʱ£¬»á²éÕÒÓëÀàͬÃûµÄ·½·¨£¬Èç¹ûÕÒµ½£¬¾ÍÈÏΪÊǹ¹Ô캯Êý£¬ÈçÏ£º
class test
{ var $b;
function test() { $this->b=5; }
function addab($c) { return $this->b+$c; }
}
$a = new test(); echo $a->addab(4); // ·µ»Ø 9
3¡¢PHP²»»á×Ô¶¯µ÷Óø¸ÀàµÄ¹¹Ô캯Êý(²»Ö§³Ö¹¹Ô캯ÊýÖØÔØ)£¬±ØÐëʹÓÃparent¹Ø¼ü×ÖÏÔʽµØµ÷Óá£
class employee{
function __construct()....
}
class Manager extents Employee{
function __construct(){
parent::_construct();
echo 'Õâ¸ö×ÓÀàµÄ¸¸À๹Ô캯Êýµ÷ÓÃÁË£¡';
}
}
µ±È»Ò²¿ÉÒÔµ÷ÓÃÓë¸ÃʵÀýûÓÐÈκιØϵµÄÆäËüÀàµÄ¹¹Ô캯Êý¡£Ö»ÐèÔÚ__construct()Ç°¼ÓÉÏÀàÃû¼´¿É¡£È磺
otherClassName::__construct();
ÀàµÄÖ÷¼ÒÍ¥³ÉÔ±£ºÊôÐÔ¡¢·½·¨¡¢³£Á¿¡¢¾²Ì¬³ÉÔ±
Èý¡¢ÀàµÄÊôÐÔ£º
ÓÐÁ½ÖÖ·½·¨¶ÔÀàµÄÊôÐÔ¸³Öµ»òÈ¡Öµ¡£
1¡¢Ê¹Óù«¹²×÷ÓÃÓòpublic¹Ø¼ü´Ê¡£
2¡¢Ê¹ÓÃ__set()ºÍ__get()À´·Ö±ð¸³ÖµºÍÈ¡Öµ£¬Ç°Õß³ÆΪÉèÖ÷½·¨£¨setter£©»òÐ޸ķ½·¨(mutator)£¬ºóÕß³ÆΪ·ÃÎÊ·½·¨(accessor)»ò»ñÈ¡·½·¨(getter)¡£½¨ÒéʹÓÃÕâÖÖ·½·¨£ºÓŵ㣺
A¡¢¿ÉÔÚ__set£¨£©Í³Ò»½øÐÐÊý¾ÝÑéÖ¤¡£
B¡¢±ãÓÚͳһ¹ÜÀíÊôÐÔ¡£
×¢Ò⣺
µÚÒ»£º__set()ºÍ__get()Ö»¶Ô˽ÓÐÊôÐÔÆð×÷Ó㬶ÔÓÚÓÃpublic¶¨ÒåµÄÊôÐÔ£¬ËüÃÇÁ½¸ö¶¼ÀÁÀí´îÀí£¬ÈçÏ£º
class test{
protected $a=9,$b=2,$c;
public $d;
function __set($n,$v) { $this->$n = $v+2; }
functio
Ïà¹ØÎĵµ£º
php ͨÓõĵ÷Óà soµÄ·½·¨ÊÇʹÓÃdl()º¯Êý£¬µ«ÊÇÔÚphp5.3Ö®ºó²»ÔÙÖ§³ÖÕâÖÖ·½·¨£¬½öÖ§³Ö¾²Ì¬µ÷Óã¬Ê¹ÓÃdl() ¶¯Ì¬µ÷Óõķ½·¨¼û£º
ÒýÓÃÒ³1: http://tech.idv2.com/2007/07/06/use-local-so-in-php/
¸ÐлÔ×÷ÕßÌṩµÄÇåÎúÃ÷Á˵ķ½·¨£¬µ«ÊÇÎÒÔÚ5.3.1°æ±¾iÖÐûÓÐͨ¹ý£¬ÓÚÊÇÎÒÕÒµ½ÁËÒ³Ã棺
  ......
function getsock($strUrl,$arrParameter=array(),$strMethod="POST"){
if(!$strUrl||!$strMethod){ return "";}
$strMethod = strtoupper($strMethod);
$arrUrl = parse_url($strUrl);
if($arrUrl["port"]==0){$arrUrl["port"]=80;}
$fso = fsockopen($arrUrl["host"],$arrUrl["port"] ......
1. ÓÃPHP´òÓ¡³öÇ°Ò»ÌìµÄʱ¼ä£¬´òÓ¡¸ñʽÊÇ2007Äê5ÔÂ10ÈÕ 22:21:21
2. PHP´úÂëÈçÏ£º
$a="hello";
$b=&$a;
unset($b);
$b="world";
echo $a;
Æä½á¹ûÊÇ£¿
3. PHP´úÂëÈçÏ£º
$str="cd";
$$str="landog";
$$str.="ok";
echo $cd;
Æ ......
½ñÌ칤×÷ÉÏÅöµ½Ò»¸öÎÊÌâ ÓÉÓÚÎÒÃǵÄÏîÄ¿Êý¾ÝÌ«ÉÙ ËùÒÔÐèÒª´Óweb searchÄDZ߽èµ÷Êý¾Ý£¬ËûÃÇÖ»¸øÎÒÃÇÌṩÁËÒ»¸öxmlµÄ½Ó¿Ú¡£Òò´Ë£¬ÎÒÃÇÐèÒª°ÑxmlµÄÊý¾Ýת»¯³Éhtml³ÊÏÖ¸ø´ó¼Ò¡£ÓÉÓÚÏîÄ¿ÊÇ»ùÓÚphpµÄ£¬ËùÒÔ¾ÍÞðÆúÁËÓÃjsÀ´¶ÁÈ¡xmlÑ¡ÔñÁ˼ÌÐøʹÓÃphp¡£²»¹ý£¬ÎÒÒÔÇ°´ÓÀ´Ã»ÓÐ×ö¹ý´ËÀàµÄ³¢ÊÔ ËùÒÔÕÒÁ˺ܶàÍøÉÏ×ÊÁÏͬʱ²ÎÕÕÁËphpµÄ¹¤× ......
Ò»¡¢
1.¼ì²éĿ¼»òÎļþµÄȨÏÞ
2.Ð޸ĻòÌí¼ÓÅäÖÃÎļþ
3.¼ì²éÅäÖÃÎļþµÄÕýÈ·ÐÔ
4.µ¼ÈëÊý¾Ý¿â
5.Ëø¶¨»òɾ³ý°²×°Îļþ
ÔÀí£º
Æäʵphp³ÌÐòµÄ°²×°ÔÀí¾ÍÊǽ«Êý¾Ý¿â½á¹¹ÄÚÈݵ¼Èëµ½ÏàÓ¦µÄÊý¾Ý¿âÖУ¬´ÓÕâ¸ö¹ý³ÌÖÐÖØзÖÅäÁ¬½ÓÊý¾Ý¿âµÄ²ÎÊýºÍÎļþ£¬ÎªÁ˱£Ö¤²»±»±ðÈ˶ñÒâÓð²×°Îļþ£¬µ±°²×°Íê³ÉºóÐèÒªÐ޸ݲװÎļþ¡£
¶þ¡¢ÖÆ×÷° ......