2010Äê×îÐÂ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 ºÍ apacheºó£¬Èç¹ûapache ²»Ö§³Ö php
1.apacheÖÐûÓÐ php¼ÓÔØÄ£¿é¡£
ÔÚhttpd.confÖмÓÈë¡£
LoadModule php5_module "c:/php5/php5apache2_2.dll"
AddType application/x-httpd-php .php
Èç¹û ²»ÄÜÕý³£Æô¶¯apache ¿ÉÄÜÊÇapache°æ ±¾µÄÊ¡£¿ÉÒÔÐÞ¸Ä LoadModule php5_module "c:/php5/php5apache2_2.dll"
&n ......
< type="text/javascript">
smarty ¿ÉÒÔÉú³É£¬
ÆäʵÉú³ÉµÄÔÀíºÜ¼òµ¥
1¡¢»ñÈ¡Ä㶯̬ҳÃæµÃÄÚÈÝ
2¡¢Ð´È뾲̬Îļþ
±ÈÈ磺
<?
//»ñÈ¡ÎļþÄÚÈÝ
$content=file_get_contents(http://www.www.com/viewPage.php?id=$id
);
//¼ì²éÊÇ·ñ´æÔÚ¾ÉÎļþ£¬ÓÐÔòɾ³ý
i ......
Ò»ÏîÄ¿¿ª·¢
ÐèÇó·ÖÎö¡¢ÏµÍ³·ÖÎö¡¢ÏµÍ³Éè¼Æ¡¢³ÌÐò¿ª·¢¡¢¼¯³ÉºÍ²âÊÔ
¶þ¡¢ÏîÄ¿·Ö¹¤
³ÌÐòÉè¼Æ¡¢¹²ÓÃ×é¼þÉè¼Æ¡¢Êý¾Ý¿â¡¢ÃÀ¹¤¡¢Îļþ±àд¡¢Êý¾ÝÊäÈë¡¢°²×°Î¬»¤¿Í·þ
Èý¡¢MySQL
Ëٶȿ죬֧³Ö¶àÏß³ÌÓë¶àÓû§Í¬Ê±ÔÚÏߵĹØϵÊý¾Ý¿â¹ÜÀíϵͳ
»ù±¾µÄMySQLÃüÁîµÄ¼ÇÒä
ËÄ¡¢HTML
»ù±¾htmlµÄÓï¾ä ......
date() ½«·þÎñÆ÷µÄʱ¼ä¸ñʽ»¯
Óï·¨ÃèÊöΪstring date(string format,int[timestamp]);·µ»ØÖµµÄÊý¾ÝÀàÐÍÊÇ×Ö·û´®¡£
º¯Êý˵Ã÷£º·µ»ØÖµµÄ×Ö·û´®°´ÅäÖõĸñʽ¾ö¶¨¡£
×Ö·û´®¸ñʽ»¯µÄÑ¡ÏîÈçÏ£º
a: "am"»òÊÇ"pm"
A: "AM"»òÊÇ"PM"
d: ¼¸ÈÕ£¬Á½Î»Êý×Ö£¬Èô²»×ãÔò²¹Á㣻´Ó"01"ÖÁ"31"
D: ÐÇÆÚ¼¸£¬3¸öÓ¢ÎÄ×Öĸ£¬Èç:"Fri"
......
×î½üÐèҪʹÓÃÏÂPHPÏà¹ØµÄ¶«Î÷£¬²éÕÒÁËһЩ×ÊÁÏ£¬ÏÖ½«PHPÅäÖ÷½·¨¼Ç¼һÏ£¬ÒÔÃâÒÔºóÍü¼Ç£¬ºÇºÇ£¬³õѧÕߣ¬¸÷λͬѧ²»ÒªÅÄש£¬¿ªÊ¼ÕýÌ⣬Ö÷Òª²Ù×÷ÈçÏ£º
1,°Ñphp-5.0.0-Win32.zip½âѹ·Åµ½C:\php
2,php.ini-dist¸ÄÃûΪphp.ini,ÕÒµ½µÚ438ÐÐ¸Ä³É extension_dir = c:\php\ext
3,È¥µô565ÐÐ;extension=php_mysql.dllÇ°ÃæµÄ";"×¢Ê ......