Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

PHPÀàµÄ×Ô¶¯¼ÓÔØ

ͨ³£ÎÒÃÇдһ¸öÀàÈçÏ£º
a.php
class A
{
public function __construct()
{
echo "hello world!";
}

page.php
require("a.php");
$a = new A(); 
ÎÒÃÇÊÇͨ¹ýÊÖ¹¤ÒýÓÃij¸öÀàµÄÎļþÀ´ÊµÏÖº¯Êý»òÕßÀàµÄ¼ÓÔØ
µ«Êǵ±ÏµÍ³±È½ÏÅÓ´ó£¬ÒÔ¼°ÕâЩÀàµÄÎļþºÜ¶àµÄʱºò£¬ÕâÖÖ·½Ê½¾ÍÏԵ÷dz£²»·½±ãÁË
ÓÚÊÇPHP5ÌṩÁËÒ»¸ö::auotload::µÄ·½·¨
ÎÒÃÇ¿Éͨ¹ý±àд¸Ã·½·¨À´×Ô¶¯¼ÓÔص±Ç°ÎļþÖÐʹÓõÄÀàÎļþ
page.php
function __autoload($classname)
{
$class_file = strtolower($classname).".php";
if (file_exists($class_file)){
require_once($class_file);
}
}
$a = new A(); 
ÕâÑù£¬µ±Ê¹ÓÃÀàAµÄʱºò£¬·¢ÏÖµ±Ç°ÎļþÖÐûÓж¨ÒåA£¬Ôò»áÖ´ÐÐautoloadº¯Êý£¬²¢¸ù¾Ý¸Ãº¯ÊýʵÏֵķ½Ê½£¬È¥¼ÓÔØ°üº¬AÀàµÄÎļþ
ͬʱ£¬ÎÒÃÇ¿ÉÒÔ²»Ê¹Óø÷½·¨£¬¶øÊÇʹÓÃÎÒÃÇ×Ô¶¨ÒåµÄ·½·¨À´¼ÓÔØÎļþ£¬ÕâÀï¾ÍÐèҪʹÓõ½º¯Êý
bool spl_autoload_register ( [callback $autoload_function] ) 
page.php
function my_own_loader($classname)
{
$class_file = strtolower($classname).".php";
if (file_exists($class_file)){
require_once($class_file);
}
}
spl_autoload_register("my_own_loader");
$a = new A(); 
ʵÏÖµÄÊÇͬÑùµÄ¹¦ÄÜ
×Ô¶¨ÒåµÄ¼ÓÔغ¯Êý»¹¿ÉÒÔÊÇÀàµÄ·½·¨
class Loader
{
public static function my_own_loader($classname)
{
$class_file = strtolower($classname).".php";
if (file_exists($class_file)){
require_once($class_file);
}
}
}
// ͨ¹ýÊý×éµÄÐÎʽ´«µÝÀàºÍ·½·¨µÄÃû³Æ
spl_autoload_register(array("my_own_loader","Loader"));
$a = new A(); 


Ïà¹ØÎĵµ£º

ubuntu10.04ÅäÖÃapache+php+mysql

1.°²×°apache2.0
¡¡¡¡sudo apt-get install apache2
¡¡¡¡°²×°ºóÔÚä¯ÀÀÆ÷Öдò¿ª£º
¡¡
¡¡http://localhost/»òÕßhttp://127.0.0.1
¡¡¡¡Èç¹û³öÏÖIt works!£¬ÄÇÖ¤Ã÷°²×°³É¹¦¡£
¡¡
¡¡2.°²×°PHP
¡¡¡¡sudo apt-get install php
5 //°²×°PHP
5
¡¡
¡¡sudo apt-get install libapache2-mod-php5 //ÅäÖÃAPACHE+PHP
¡¡¡¡sud ......

Linux+Apache+Mysql+PhpÏêϸ°²×°Îĵµ

ËùÐèÈí¼þÔ´´úÂë°ü£º
httpd-2.2.4.tar.gz   mysql-5.0.27.tar.gz   php-5.2.1.tar.bz2
freetype-2.3.2.tar.gz   gd-2.0.34.tar.gz   jpegsrc.v6b.tar.gz
libpng-1.2.8.tar.bz2   libxml2-2.6.24.tar.bz2  zlib-1.2.2.tar.gz
°²×°Ë³Ðò£ºapache -> mysql ......

Apache 2 and PHP 5 (mod_php) on Linux


Apache 2 and PHP Installation
The following notes are how I got Apache 2 and PHP 5 (or PHP 4) working together on Linux. These instructions also apply, mostly, for any UNIX-like system, especially other Linux distributions. If you have a recent Linux distribution (say since 2002), you already hav ......

¡¾±±¾©PHPÅàѵ¡¿±±¾©´óѧPHP¹¤³Ìʦ°à»ðÈÈÕÐÉú£¡


    ±±¾©´óѧPHP¹¤³Ìʦ°àÕÐÉú¼òÕÂ
   ÍøÖ·£ºwww.pku-it.com
      ½üÄêÀ´£¬PHPÓïÑÔÒÔÆä¼ò½àÁé»îµÄ±à³Ìģʽ¡¢ÈÕÇ÷ÍêÉƵļ¼ÊõÌåϵÒÔ¼°Ç¿ÓÐÁ¦µÄ¿ªÔ´Ö§³Ö£¬Ñ¸ËÙ·¢Õ¹³ÉΪȫÇò»¥ÁªÍøÓ¦ÓÃ×îΪ¹ã·ºµÄ±à³ÌÓïÑÔ¡£Ä¿Ç°ÒÑÓг¬¹ý40%µÄWEB³ÌÐòʹÓÃPHPÀ´±àд£¬°Ù¶È¡¢ÌÚÑ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ