PHPÖÐ__autoload()º¯ÊýµÄʹÓÃ
ÎÒÃÇÖªµÀÔÚPHP4ÀïÃ棬µ±ÎÒÃÇʹÓÃÒ»¸öÀàµÄʱºò£¬±ØÐ뽫¸ÃÀàËùÒÔÎļþʹÓÃinclude»òrequire¼Ó½øÀ´£¬ÕâÑùÎÒÃǾͿÉÒÔʹÓÃÀàÁË¡£
¶ø¶ÔÓÚPHP5À´ËµÒ²¿ÉÒÔʹÓÃÔÚPHP4ÀïÃæµÄ·½Ê½£¬½«ÀàÎļþ°ü½øÀ´£¬µ«µ±ÓÐÁË__autoloadÖ®ºó£¬ÕâÖÖÇé¿ö¾Í¿ÉÒÔ¿¿±àд¹æÔòҲʵÏÖ¡£
ÒÔÏ´úÂ룺
<?php
$obj_A = new clsA();
$obj_B = new clsB();
?>
PHP4ÏÂÕýȷд·¨Îª£º
<?php
//PHP4 д·¨£¬Ö®Ç°±ØÐë¼ÓÔØÀàÎļþ
include_once "cls/clsA.php";
include_once "cls/clsB.php";
$obj_A = new clsA();
$obj_B = new clsB();
?>
´¦Àí¼ÓÔز½ÖèΪ£º
1,¼ÓÔØÀàÎļþ¡£
2,ʵÀý»¯Àà¡£
PHP5ÏÂʹÓÃ__autoload()£¨×Ô¶¯¼ÓÔØ£©µÄÕýȷд·¨Îª£º
<?php
// PHP5 Used __autoload function
$obj_A = new clsA();
$obj_B = new clsB();
function __autoload($className){
include_once "cls/$className.php";
}
?>
´¦Àí¼ÓÔز½ÖèΪ£¨Ê¹ÓÃautoloadº¯Êý£©£º
1,´´½¨¶ÔÏó£¨Î±ÊµÀý£©
2,µ÷ÓÃ__autoloadº¯Êý£¬½«Î±ÊµÀýµÄÀàÃû´«Èë
3,ʹÓÃ__autoloadº¯ÊýÖУ¬Ô¤ÏÈдºÃµÄ¼ÓÔعæÔò½øÐмÓÔØÀàÎļþ
4,ʵÀý»¯¶ÔÏó£¨ÕæʵʵÀý£©
Òò´Ë£¬ÎÒÃÇ¿ÉÒÔ¿´³ö£¬¶ÔÓÚPHP5µÄautoloadº¯Êý£¬±ØÐë¸ø¶¨¹æÔò£¬·ñÔòÒ»µãÓÃûÓС£
¶ÔÓÚPHP5µÄ__autoloadº¯ÊýµÄʹÓÃʱÐèҪעÒâ»òÍê³ÉÈçÏÂÊÂÇé¡£
1,__autoloadº¯ÊýÊÇÓÃÔÚÀàÍâÃ棬¶ø²»ÊÇÔÚÀàÀïÃæµÄº¯Êý¡££¨__autoloadÒ²ÊDZ»PHP5±£»¤µÄ¹Ø¼ü×ÖÖ®Ò»£©
2,Íê³É¶Ô__autoloadº¯Êý¼ÓÔعæÔòµÄ±àÂë¡£
ÈçÉÏ£¬µ±ÖªµÀAÊÇÔÚclsĿ¼ÖУ¬¶øBÊÇÔÚcls/clsĿ¼ÖС£Ôò±àд__autoload¼ÓÔعæÔò¾ÍÊDZØÒªµÄ¡£
<?php
// PHP5 Used __autoload function
$obj_A = new clsA(); // in "cls" directory!
$obj_B = new clsB(); // in "cls/cls" directory!
function __autoload($className){
if(strtolowwer($className) == "clsb"){
require_once "cls/cls/$className.php";
}else{
include_once "cls/$className.php";
}
}
?>
×ܽ᣺Òò´Ë£¬¶Ô
Ïà¹ØÎĵµ£º
#################################
##########BY:Moskey.Tong#########
###########2009-11-15############
#########*תÔØÇë×¢Ã÷*############
#################################
×ܽáÒ»ÏÂÕâ¸öÐÇÆÚÌìPHPÉÏ´«Í¼Æ¬¡£
ÉÏ´«Í¼Æ¬ÔÀí£ºÊ×ÏÈÅжÏÎļþÀàÐÍÊÇ·ñΪͼƬ¸ñʽ£¬ÈôÊÇÔòÉÏ´«Îļþ£¬È»ºóÖØÃüÃûÎļþ£¨Ò»°ã¶¼ÊDZÜÃâÉ ......
iconvº¯Êý¿âÄܹ»Íê³É¸÷ÖÖ×Ö·û¼¯¼äµÄת»»£¬ÊÇphp±à³ÌÖв»¿ÉȱÉٵĻù´¡º¯Êý¿â¡£
1¡¢ÏÂÔØlibiconvº¯Êý¿âhttp://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.9.2.tar.gz£»
2¡¢½âѹËõtar -zxvf libiconv-1.9.2.tar.gz;
3¡¢°²×°libiconv
££configure --prefix=/usr/local/iconv
#make
#make install
4¡¢ÖØбàÒëphp Ô ......
Ê×ÏÈ£¬½¨InnoDBÀàÐÍµÄ±í£¬²ÅÄÜÖ§³ÖÊÂÎñ
$handler = mysql_connect('localhost', '', '');
mysql_select_db('test');
mysql_query('SET AUTOCOMMIT=0'); // ÉèÖÃΪ²»×Ô¶¯Ìá½»²éѯ
mysql_query('START TRANSACTION'); // ¿ªÊ¼²éѯ£¬ÕâÀïÒ²¿ÉÒÔʹÓÃBEGIN
mysql_query("INSERT INTO users VALUES ('ccc')");
mysql_query( ......
php¹Ù·½ÍøÕ¾Ôõô¾ÍûÓиöÏêϸµÄÔÚwindowsÉϲ¿ÊðµÄÎĵµÄØ
ÎÒÔÚwindows2003Éϲ¿Êðphp£¬ÀÏÊdzöÏÖ404´íÎó
²éÁËgoogle£¬°´ÕÕÉÏÃæ˵µÄÔö¼ÓÁËwebÀ©Õ¹Ò²²»ÐÐ
¿ªÁËĿ¼ä¯ÀÀ£¬¸ùĿ¼ÏÂÃæ¾ÓȻûÓÐindex.phpºÍÆäËûµÄphpÎļþ
ÎÒÈËÆ·¿´À´²»ÐÐÁË ......