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

¹ØÓÚ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¿ÉÒÔÔÚϵͳÈκεط½Ê¹Óã¬Ö»ÐèÒªÔÚºóÃ


Ïà¹ØÎĵµ£º

PHPÏòÒ»¸ö×Ö·û´®Ëæ»úÌí¼ÓÎÄ×Ö

 ºÜ¾ÃÇ°ÔÚbaidu»Ø´ðÎÊÌâʱдµÄ“ÏòÒ»¸ö×Ö·û´®Ëæ»úÌí¼ÓÎÄ×Ö”µÄ½â¾ö·½°¸£¬¿ÉÒÔÖ§³ÖÖÐÓ¢ÎÄ
<?php
/*********************************************************
 describe£º×Ö·û´®´¦Àí,¿ÉÒÔ´¦ÀíÖÐÓ¢ÎÄ
 function£ºÏòÒ»¸ö×Ö·û´®Ëæ»úÌí¼ÓÎÄ×Ö
 author£º  etongchina
 email2m ......

»ð³µÍ·discuz6.1ÍêÃÀ²É¼¯µÄphp½Ó¿ÚÎļþ

 
»ð³µÍ·¹Ù·½ÌṩµÄdiscuz6.1µÄphp½Ó¿Ú±È½Ï´Ö²Ú£¬»ù±¾²»ÄÜÂú×ãÐèÒª£¬±¾ÈËÔڲɼ¯µÄ¹¤×÷ÖÐʹÓõIJɼ¯½Ó¿ÚÎļþÈçÏ£º
PS£º¶ÔÔ­ÎļþµÄÐ޸Ľϴó,³ÌÐòÖÐ×¢ÊÍÒѾ­ºÜÏ꾡£¬ÕâÀï¾Í²»¶à˵ÁË¡£
<?php
// header('Content-Type:text/html;charset=UTF-8');
//if(function_exists("mb_convert_encoding")){ ......

PHP~ Ò»ÑÔÄѾ¡~~~~~~~~~~ÎÒ×Ô¼ºµÄ¹ÊÊÂ

ÎÄÕÂÔ­ÏÈ·¢±íÔÚCSDNÂÛ̳ÉÏÃ棬µ«ÊǺóÀ´¾õµÃ²»Ì«Íס£ËùÒÔûÓÐÔÚCSDNÖмÌÐøдÏÂÈ¥£¬×ª·¢µ½ÕâÀïÁË¡£
Ô­Ìûhttp://topic.csdn.net/u/20090910/13/fc1e87d1-79b8-488b-b94a-403a0147bca8.html?80258
-------------------------------------------------------------
°¦~
ѧPHPÒ²²»ÖªµÀÓж೤ʱ¼äÁË¡£
·´Õý´Ó´óÒ»µÄʱºò¿ª ......

PHPÄ£°åÒýÇæSmarty»º´æÓ¦ÓÃ

1£ºsmarty »º´æµÄÅäÖÃ
      
Php´úÂë
$smarty->cache_dir = "/caches/"; //»º´æĿ¼
$smarty->caching = true; //¿ªÆô»º´æ,ΪflaseµÄʱºî»º´æÎÞЧ
$smarty->cache_lifetime = 60; //»º´æʱ¼ä
2:smarty»º´æµÄʹÓúÍÇå³ý
   
Php´úÂë
$smarty->di ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ