php include_pathÉèÖÃ
Ò»°ãÇé¿öÏ£¬ÎÒÃÇÉèÖÃphpµÄinclude_path¶¼»áͨ¹ýÐÞ¸Äphp.iniÀ´ÊµÏÖ¡£
ÓÐʱºò£¬ÎÒÃÇûÓзþÎñÆ÷µÄȨÏÞ¡£ÓÐʱºò£¬ÎÒÃÇ°ÑÒ»¸öĿ¼¼Óµ½include_path»áÈÃÒÑÓеijÌÐò³åÍ»¡£ÊÜcakephpµÄÆô·¢:ÔÚapp/webrootĿ¼ÏÂindex.phpÓÐÈçÏ´úÂë
<?php
ini_set('include_path', CAKE_CORE_INCLUDE_PATH . PATH_SEPARATOR . ROOT . DS . APP_DIR . DS . PATH_SEPARATOR . ini_get('include_path'));
?>
ÎÒÃÇ¿´µ½Õâ¸ö³ÌÐò¶¯Ì¬ÐÞ¸Äinclude_path¡£²»¹ýcakeÔÚÕâ¶ùÊÇ°Ñ CAKE_CORE_INCLUDE_PATH ºÍ APP_DIR ¼Óµ½ include_pathÀ²¢ÇÒÓÅÏÈÔÚÕâÁ½¸öĿ¼ÏÂÕÒ°üº¬³ÌÐò¡£
×¢Òâµ½ËüÕâÀïÓõ½ÁËPATH_SEPARATORÕâ¸ö±äÁ¿¡£ÕâÑùÕâ¶Î´úÂëÔÚwindowsºÍlinuxÏÂÄÜͨÓá£
´ÓÖÐÊܵ½Æô·¢£¬ÎÒÃÇ¿ÉÒÔ¸ù¾Ý×Ô¼ºµÄÐèÒª°ÑһЩincludeĿ¼¶¯Ì¬µÄ¼ÓÈë½øÀ´¡£±ÈÈç˵ÎÒÃÇÓкܶàlibs:lib1,lib2,lib3µÈµÈ¡£ÎÒÃDz»±Ø°ÑÕâЩlibs¶¼¼Óµ½include_pathÀÒòΪËüÃÇÖ®¼ä¿ÉÄܳåÍ»¡£
¿ÉÒÔ½¨Á¢Ò»¸öinc_dir,²¢°ÑÕâ¸öĿ¼¼ÓÈëµ½include_path¡£ÔÚinc_dirÏ£¬·Ö±ð½¨Á¢inc_path1.php inc_path2.php inc_path3.php
·Ö±ðдÈë
<?php
//set_include_path('.'.PATH_SEPARATOR.get_include_path().PATH_SEPARATOR.'E:/DQG/inc');
ini_set('include_path', ini_get('include_path').PATH_SEPARATOR.$dirToLib1);
ini_set('include_path', ini_get('include_path').PATH_SEPARATOR.$dirToLib2);
ini_set('include_path', ini_get('include_path').PATH_SEPARATOR.$dirToLib3);
?>
ÔÚд³ÌÐòµÄʱºò£¬±ÈÈçÒªÓÃlib2µÄfunctions.php
¾Í¿ÉÒÔÕâôд
<?php
require 'inc_path2.php';
require 'functions.php';
?>
Ïà¹ØÎĵµ£º
1 echo();2 print();3 die();4 printf();5 sprintf();6 print_r();7 var_dump();
1 echo()
¿ÉÒÔͬʱÊä³ö¶à¸ö×Ö·û´®,¿ÉÒÔ¶à¸ö²ÎÊý,²¢²»ÐèÒªÔ²À¨ºÅ,ÎÞ·µ»ØÖµ¡£
2 print()
Ö»¿ÉÒÔͬʱÊä³öÒ»¸ö×Ö·û´®£¬Ò»¸ö²ÎÊý,ÐèÒªÔ²À¨ºÅ,Óзµ»ØÖµ,µ±ÆäÖ´ÐÐʧ°Üʱ·µflase .print µÄÓ÷¨ºÍCÓï ......
class lamp
{
public function __construct()
{
}
public function __get($var) //»ñÈ¡²»´æÔÚµÄÊôÐÔʱµ÷ÓÃ
{
echo "²»´æÔÚ±äÁ¿$var<br>";
}
public function __set($var ......
<?php
/* ¶þ½øÖÆȨÏÞ¿ØÖÆPHPÀà
* ×÷ Õß: ¶à²ËÄñ
* ÓÊ Ïä: kingerq AT QQ DOT com
* À´ Ô´£ºhttp://blog.csdn.net/kingerq/archive/2009/10/22/4714223.aspx
* ´´½¨Ê±¼ä: 2009-10-22
*/
class binPower{
var $power = "";
//ȨÏÞ´æÖü±äÁ¿,Ê®½øÖÆÕûÊý
function __construct($power) ......
±¾½Ì³ÌÀ´×ÔPHP½Ì³ÌÍø(www.phpjc.cn)
PHP ÖеıäÁ¿
±äÁ¿ÓÃÓÚ´æ´¢Öµ£¬±ÈÈçÊý×Ö¡¢Îı¾×Ö·û´®»òÊý×é¡£
Ò»µ©ÉèÖÃÁËij¸ö±äÁ¿£¬ÎÒÃǾͿÉÒÔÔڽű¾ÖÐÖظ´µØʹÓÃËü¡£
PHP ÖеÄËùÓбäÁ¿¶¼ÊÇÒÔ $ ·ûºÅ¿ªÊ¼µÄ£¬±äÁ¿ÃûÊÇÇø·Ö´óСдµÄ¡£
ÔÚ PHP ÖÐÉèÖñäÁ¿µÄÕýÈ··½·¨ÊÇ£º
$var_name = value;
PHP µÄÈëÃÅÕßÍùÍù»áÍü¼ÇÔÚ±äÁ¿µÄÇ°Ãæµ ......