¹ØÓÚPHPÖеÄ·¾¶ÎÊÌâ
1¡¢Ê¹Óþø¶Ô·¾¶°üº¬Îļþ
ÔÚÿ´Î¶ÔÎļþµÄ°üº¬ÖУ¬¶¼Ê¹ÓÃϵͳ¾ø¶Ô·¾¶½øÐаüº¬£¬±ÈÈç require('/var/www/html/inc/test.inc')£»µÄ·½Ê½£¬ÔÚËùÓÐÎļþÖж¼ÕâÑù°üº¬¾Í¿ÉÒÔ±ÜÃâ¶à¼¶°üº¬³öÏÖµÄÎÊÌ⣬µ«ÊÇÕâÖз½Ê½²»Áé»î£¬ÏµÍ³¿ÉÒÆÖ²ÐÔ¼«²î£¬½¨Òé²»²ÉÓá£
2¡¢ÔÚÒ»¸ö¹«ÓÃÎļþÖж¨Ò幫ÓÃÎļþµÄÁÐ±í£¬½«¸÷¸ö¹«ÓÃÎļþµÄÍêÕû·¾¶¶¨ÒåΪ±äÁ¿»òÕߺ꣬ϵͳÖи÷¸öÎļþ²ÉÓÃÏà¶Ô·¾¶µÄ·½Ê½°üº¬´Ë¹«ÓÃÎļþ£¬È»ºóʹÓñäÁ¿°üº¬ÐèÒª°üº¬µÄÎļþ£¬ÕâÑù¿ÉÒÔʵÏÖͳһά»¤Ò»¸öÎļþ¼´¿É£¬µ«ÊÇÕâÖÖ·½Ê½¸Ð¾õÈÔÈ»²»ÊǺÜˬ£¬ÒÆÖ²ÆðÀ´Ð޸ĵĵط½ÈÔÈ»½Ï¶à¡£
3¡¢½«ËùÓеijÌÐò·Åµ½Ò»¸öĿ¼Ï£¬ÕâÑùËùÓеİüº¬µ÷Óö¼Ê¹Óõ±Ç°Â·¾¶£¬¾Í±ÜÃâÁË·¾¶ÎÊÌ⣬ÕâÖÖ·½Ê½Ôںܶ࿪ԴµÄÂÛ̳³ÌÐòÖн϶à²ÉÓ㬵«ÊÇÕâÑùµÄ½á¹¹¶Ô±È½Ï´óÐͺ͸´ÔÓµÄϵͳӦÓôæÔÚÃ÷ÏԵIJ»×ã¡£
4¡¢ÐÞ¸Äphp.iniÎļþ£¬ÔÚphp.iniÖÐÉèÖà include_pathÏ½«ËùÓеĹ«ÓÃÎļþºÍÐèÒª½øÐе÷Óðüº¬µÄÎļþ·¾¶Ð´½øÕâ¸öÉèÖÃÏîÀÕâÑùÔÚ³ÌÐòÖÐÎÞÂÛµ±Ç°ÎļþÔÚʲô·¾¶£¬¾ù²ÉÓõ±Ç°Â·¾¶µÄ·½Ê½½øÐаüº¬£¬Õâ¸öºÍPHPµÄPEAR°²×°ºÍµ÷Ó÷½Ê½Ò»Ñù£¬ÕâÖз½Ê½ÊµÏÖ¼òµ¥£¬ÒÆÖ²ÐÔÇ¿£¬½¨Òé²ÉÓá£
5¡¢×îºóÒ»ÖÖ·½Ê½£¬Ò²ÊDzÉÓù«ÓÃÎļþ¶¨Òå·¾¶µÄ·½Ê½£¬ÕâÒ²ÊÇÎÒ³£Ê¹Óõķ½Ê½£¬ÔÚÎÒµÄÓ¦ÓÃÖж¨ÒåÒ»¸öpath.phpÎļþ£¬ÔÚÎļþÖж¨Ò嵱ǰӦÓõÄÈ«¾Ö·¾¶±äÁ¿ $ROOT_PATH£¬ËùÓеÄÓ¦ÓÃÎļþ¶¼µ÷ÓúͰüº¬path.phpÎļþ£¬Õâ¸öÎļþ¿ÉÒԷŵ½php.iniµÄinclude_pathÉèÖõÄĿ¼Ï£¬Ò²¿ÉÒԷŵ½ÏµÍ³¸ù /Ï£¬Ò²¿ÉÒԷŵ½Èκεط½£¬Ö»ÒªµÄÏà¶Ô¹Ì¶¨µÄ£¬½¨Òé·Åµ½include_path¶¨ÒåµÄĿ¼Ï£¬path.phpÎļþ¸ù¾Ýµ±Ç°·ÃÎʵÄÒ³ÃæÏà¶ÔµÄPHP_SELFֵȡµÃ·¾¶ÐÅÏ¢£¬È»ºóͨ¹ý¼ÆËãµÄ·½Ê½µÃ³öµ½ÍøÕ¾Ïà¶Ô¸ùĿ¼µÄÏà¶Ô·¾¶£¬ÏÂÃæÊÇÎÒµÄpath.phpÎļþµÄ¼ÆËã$ROOT_PATHÖµµÄ·½Ê½£º
/**
* »ñÈ¡µ±Ç°Îļþָͬ¶¨ÍøÕ¾Ïà¶Ô¸ùĿ¼µÄĿ¼²ãÊý $ROOT_PATH
* $ROOT_PATH ±äÁ¿ÖµÄ©Î²°üº¬ÁË·¾¶µÄ"/"·ûºÅ£¬ÔÚÒýÓÃʱ²»ÒªÔÙ¼Ó"/"
* example: $ROOT_PATH."images/logo.gif"
*/
$_self_path = ($_SERVER['PHP_SELF'] == "" )? $_SERVER['REQUEST_URI'] : $PHP_SELF;
$_path_array = explode("/",$_self_path);
$_path_count = count($_path_array);
$ROOT_PATH = "";
for ($i=0;$i<$_path_count-2;$i++)
{
$ROOT_PATH = '../'.$ROOT_PATH;
}
Õâ¸ö$ROOT_PATH¿ÉÒÔÔÚϵͳÈκεط½Ê¹Óã¬Ö»ÐèÒªÔÚºóÃ
Ïà¹ØÎĵµ£º
½ñÌìÈ¥XX¹«Ë¾ÃæÊÔÁË£¬¸Ð¾õºÜ²»ÀíÏë¡£ÒòΪÕâÒ»¶Îʱ¼ä¶¼ÔÚ¼ÓÉîZend Framework£¬¶¼Ã»Á·Ï°³£Óú¯ÊýºÍ·½·¨ÁË¡£
±ÊÊԻشðµÄ²»Ì«ºÃ£¬ÌرðÊÇJS²¿·Ö£¬Ò²ÊÇÐí¾Ã¶¼Ã»¸´Ï°µÄÔÒò¡£
ÉÏ»úÌâÄ¿ÊÇҪдһ¸ö·Âgoogle·ÖÒ³µÄÀ࣬µ±ÒªÈ¡ÀàËÆ9/2µÄ×î´óÕûÊý£¬È´ÔõôҲÏë²»Æðº¯ÊýceilµÄÃû×Ö£¬ÔÎÁË°ëÌì¡£
×îºó²âÊÔ³ÌÐòû´íÎ󣬵«ÊǾÍÊDz»ÄÜÕ ......
ÎÄÕÂÔÏÈ·¢±íÔÚCSDNÂÛ̳ÉÏÃ棬µ«ÊǺóÀ´¾õµÃ²»Ì«Íס£ËùÒÔûÓÐÔÚCSDNÖмÌÐøдÏÂÈ¥£¬×ª·¢µ½ÕâÀïÁË¡£
ÔÌûhttp://topic.csdn.net/u/20090910/13/fc1e87d1-79b8-488b-b94a-403a0147bca8.html?80258
-------------------------------------------------------------
°¦~
ѧPHPÒ²²»ÖªµÀÓж೤ʱ¼äÁË¡£
·´Õý´Ó´óÒ»µÄʱºò¿ª ......
Ò»¡¢ ¿ª·¢³ÉÔ±
a)ÏîÄ¿Ö÷¹Ü
b)Ò³ÃæÃÀ¹¤
c)Ò³Ã濪·¢
d)·þÎñ¶Ë³ÌÐò¿ª·¢
e)ϵͳÓëÊý¾Ý¹ÜÀí
f)²âÊÔÓë°æ±¾¿ØÖÆ
¶þ¡¢ ÍøÕ¾×鿪·¢¼òÃ÷Á÷³Ì
Èý¡¢ ¿ª·¢¹¤¾ßÓë»·¾³
a) ·þÎñÆ÷ÅäÖÃ
i. WEB·þÎñÆ÷£º FreeBSD6.1+Apache2.0+PHP5.0£¬SVN°æ±¾¿ØÖÆ·þÎñ(½ö²âÊÔ»ú)¡£
ii. Êý¾Ý¿â·þÎñÆ÷£º WIN2003 server+SQL server 2000 ......
//±éÀúĿ¼¼°Îļþ
function get_all_files( $path )
{
$list = array();
foreach( glob( $path . '/*') as $item )
{
& ......