PHPÎļþ°üº¬Â©¶´ÔÀí·ÖÎöºÍÀûÓ÷½·¨
ÕªÒª£ºÒ»¡¢Éæ¼°µ½µÄΣÏÕº¯Êý¡²include(),require()ºÍinclude_once(),require_once()¡³ include()&&require()Óï¾ä:°üÀ¨²¢ÔËÐÐÖ¸¶¨Îļþ¡£ÕâÁ½Öֽṹ³ýÁËÔÚÈçºÎ´¦Àíʧ°ÜÖ®ÍâÍêÈ«Ò»Ñù¡£include()²úÉúÒ»¸ö¾¯¸æ¶ørequire()Ôòµ¼ÖÂÒ»¸öÖÂÃü´íÎó¡£»»¾ä»°Ëµ£¬Èç¹ûÄãÏëÔÚÓöµ½¶ªÊ§Îļþʱֹͣ´¦ÀíÒ³Ãæ¾ÍÓÃrequire()¡£include()¾Í²»ÊÇÕâÑù¡£
±¾ÎÄÕ¼òµ¥ÕªÒª£ºÒ»¡¢Éæ¼°µ½µÄΣÏÕº¯Êý¡²include(),require()ºÍinclude_once(),require_once()¡³ include()&&require()Óï¾ä:°üÀ¨²¢ÔËÐÐÖ¸¶¨Îļþ¡£ÕâÁ½Öֽṹ³ýÁËÔÚÈçºÎ´¦Àíʧ°ÜÖ®ÍâÍêÈ«Ò»Ñù¡£include()²úÉúÒ»¸ö¾¯¸æ¶ørequire()Ôòµ¼ÖÂÒ»¸öÖÂÃü´íÎó¡£»»¾ä»°Ëµ£¬Èç¹ûÄãÏëÔÚÓöµ½¶ªÊ§Îļþʱֹͣ´¦ÀíÒ³Ãæ¾ÍÓÃrequire()¡£include()¾Í²»ÊÇÕâÑù¡£
Ò»¡¢Éæ¼°µ½µÄΣÏÕº¯Êý¡²include(),require()ºÍinclude_once(),require_once()¡³
include() && require()Óï¾ä:°üÀ¨²¢ÔËÐÐÖ¸¶¨Îļþ¡£
ÕâÁ½Öֽṹ³ýÁËÔÚÈçºÎ´¦Àíʧ°ÜÖ®ÍâÍêÈ«Ò»Ñù¡£include() ²úÉúÒ»¸ö¾¯¸æ¶ø require() Ôòµ¼ÖÂÒ»¸öÖÂÃü´íÎó¡£»»¾ä»°Ëµ£¬Èç¹ûÄãÏëÔÚÓöµ½¶ªÊ§Îļþʱֹͣ´¦ÀíÒ³Ãæ¾ÍÓà require()¡£include() ¾Í²»ÊÇÕâÑù£¬½Å±¾»á¼ÌÐøÔËÐС£
Èç¹û”allow_url_fopen”ÔÚ PHP Öб»¼¤»î£¨Ä¬ÈÏÅäÖã©£¬Ò²¿ÉÒÔÓà URL£¨Í¨¹ý HTTP »òÕßÆäËüÖ§³ÖµÄ·â×°ÐÒ飩¶ø²»ÊDZ¾µØÎļþÀ´Ö¸¶¨Òª±»°üÀ¨µÄÎļþ¡£Èç¹ûÄ¿±ê·þÎñÆ÷½«Ä¿±êÎļþ×÷Ϊ PHP ´úÂë½âÊÍ£¬Ôò¿ÉÒÔÓÃÊÊÓÃÓÚ HTTP GET µÄ URL ÇëÇó×Ö·û´®À´Ïò±»°üÀ¨µÄÎļþ´«µÝ±äÁ¿¡£
Ïêϸ²Î¿¼£ºhttp://www.phpe.net/manual/function.include.php
require_once()¡¡£¦£¦¡¡include_once()
require_once()ºÍinclude_once() Óï¾äÔڽű¾Ö´ÐÐÆÚ¼ä°üÀ¨²¢ÔËÐÐÖ¸¶¨Îļþ¡£´ËÐÐΪºÍ require() Óï¾äÀàËÆ£¬Î¨Ò»Çø±ðÊÇÈç¹û¸ÃÎļþÖеĴúÂëÒѾ±»°üÀ¨ÁË£¬Ôò²»»áÔٴΰüÀ¨¡£ÊÊÓÃÓÚÔڽű¾Ö´ÐÐÆÚ¼äͬһ¸öÎļþÓпÉÄܱ»°üÀ¨³¬¹ýÒ»´ÎµÄÇé¿öÏ£¬ÄãÏëÈ·±£ËüÖ»±»°üÀ¨Ò»´ÎÒÔ±ÜÃ⺯ÊýÖض¨Ò壬±äÁ¿ÖØи³ÖµµÈÎÊÌâ¡£
Ïêϸ²Î¿¼£ºhttp://www.phpe.net/manual/function.require-once.php
¶þ¡¢ÎªÊ²Ã´Òª°üº¬Îļþ
³ÌÐòԱд³ÌÐòµÄʱºò£¬²»Ï²»¶¸ÉͬÑùµÄÊÂÇ飬Ҳ²»Ï²»¶°ÑͬÑùµÄ´úÂ루±ÈÈçһЩ¹«Óõĺ¯Êý£©Ð´¼¸´Î£¬ÓÚÊǾͰÑÐèÒª¹«ÓõĴúÂëдÔÚÒ»¸öµ¥¶ÀµÄÎļþÀïÃ棬±ÈÈç share.php£¬¶øºóÔÚÆäËüÎļþ½øÐаüº¬µ÷Óá£ÔÚphpÀÎÒÃǾÍÊÇʹÓÃÉÏÃæÁоٵÄÄǼ¸¸öº¯ÊýÀ´´ïµ½Õâ¸öÄ¿µÄµÄ£¬ËüµÄ¹¤×÷Á÷³Ì£ºÈç¹ûÄãÏëÔÚ main.phpÀï°üº¬share.php,ÎÒ½«ÕâÑùдinclude(”
Ïà¹ØÎĵµ£º
YiiÊÇÒ»¸ö¸ßÐÔÄܵÄPHP5µÄwebÓ¦ÓóÌÐò¿ª·¢¿ò¼Ü¡£Í¨¹ýÒ»¸ö¼òµ¥µÄÃüÁîÐй¤¾ß yiic ¿ÉÒÔ¿ìËÙ´´½¨Ò»¸öwebÓ¦ÓóÌÐòµÄ´úÂë¿ò¼Ü£¬¿ª·¢Õß¿ÉÒÔÔÚÉú³ÉµÄ´úÂë¿ò¼Ü»ù´¡ÉÏÌí¼ÓÒµÎñÂß¼£¬ÒÔ¿ìËÙÍê³ÉÓ¦ÓóÌÐòµÄ¿ª·¢¡£
а汾ÐÞÕýÁË´óÁ¿µÄbug£¬¶Ô³¬¹ý20ÏîµÄ¹¦ÄܽøÐÐÁ˸Ľø£»Í¨¹ýɾ³ýÎÞÓÃµÄ SQL JOIN À´ÌáÉýÁËÀÁģʽϹØϵ AR ²éѯµÄÐÔÄÜ¡£
......
test.php -------------------------------------------------------------------------------------
echo $_SERVER['DOCUMENT_ROOT'].""; //»ñµÃ·þÎñÆ÷Îĵµ¸ù
echo $_SERVER['PHP_SELF'].""; //»ñµÃÖ´ÐиôúÂëµÄÎļþ·þÎñÆ÷¾ø¶Ô·¾¶
/*
phpÊÖ²áÉϵĽâÊÍ£º “PHP_SELF” µ±Ç°ÕýÔÚÖ´Ðнű¾µÄÎļþÃû£¬Óë docum ......
php°²×°
# tar xzvf php-5.2.5.tar.gz
# cd php-5.2.5
./configure --prefix=/home/redadmin/php --with-apxs2=/home/redadmin/apache/bin/apxs --with-mysql=/home/redadmin/mysql --enable-mbstring=all --enable-track-vars
# make && make install
# cp php.ini-dist /home/redadmin/php/lib/php.ini
# c ......
¿ªÔ´½¨Õ¾³ÌÐòÈñà³Ì¸ßÊÖºÍÖ»¶®´ò×ÖÉÏÍøµÄÈ˶¼¿ÉÒÔ¿ìËÙ½¨Á¢Ò»¸ö¹¦ÄÜÇ¿´ó¡¢½çÃæƯÁÁµÄÍøÕ¾¡£²»¹ÜÄãÊÇÏ뽨һ¸ö²©¿Í¡¢ÂÛ̳¡¢CMS¡¢µç×ÓÉÌÎñÍøÕ¾£¬»òÊÇWiki¡¢Ïà²á¹ÜÀí¡¢RSS¾ÛºÏºÍÀàDiggÍøÕ¾¡£Ä㶼¿ÉÒÔͨ¹ýÕâЩ½¨Õ¾¹¤¾ß¿ìËÙ½¨Á¢¡£
ÎÒÃÇ֮ǰ½éÉܹý23¸ö¿ªÔ´µÄCMS¹ÜÀíϵͳ£¬ÏÖÔÚÔòÈÃÎÒÃÇÀ´¿´Ò»ÏÂ26¿î¿ªÔ´½¨Õ¾³ÌÐò¡£
......
ż¶û×ö¸ö¼òµ¥µÄWEB·þÎñ²âÊÔ³ÌÐò£¬ÎÒ»¹ÊÇϲ»¶²ÉÓÃPHP¡£¼ò½à£¬·ç¸ñºÍC/C++½Ó½ü£¬ÉÏÊֿ죬¶øÇÒ¿âÒ²ºÜÆëÈ«¡£ÒÔǰΪ¹ã¶«Òƶ¯×öÒƶ¯ÐÐÒµÖն˵ÄÑÝʾ³ÌÐòʱ£¬²ÉÓùúÄÚÒ»¸öÐÖµÜдµÄFleaPHP¿ªÔ´¿ò¼Ü£¬Á½Öܲ»µ½µÄʱ¼ä£¬ÎÒ´ÓÒ»¸ö¶ÔPHPÒ»ÎÞËùÖªµÄˮƽ£¬¿ìËٵĸ㶨ÁË30¶à¸öÒ³ÃæµÄºǫ́£¬ºóÀ´ÑÝʾЧ¹ûÒ²²»´í£¬Ò²ºÜÎȶ¨£¬´Ó´Ë¶ÔPHPÓÐÁ ......