function initialize(){    set_include_path(get_include_path().PATH_SEPARATOR . "core/");    set_include_path(get_include_path().PATH_SEPARATOR . "app/");    set_include_path(get_include_path().PATH_SEPARATOR . "admin/");    s…
首先set_include_path这个函数呢,是在脚本里动态地对PHP.ini中include_path进行修改的.而这个include_path呢,它可以针对下面的include和require的路径范围进行限定,或者说是预定义一下.       如果我们没有设置这个值,可能我们需要写一些完全的路径:       <?php          include("123/test1.php");          include("123/test2.php"…
目的:在框架中方便加载文件 参考:http://blog.sina.com.cn/s/blog_4ce89f200100twbl.html 如果我们没有设置这个值,可能我们需要写一些完全的路径:       <?php          include("123/test1.php");          include("123/test2.php");          include("123/test3.php");        …
<?php set_include_path($string); //设置路径 get_include_path(); // 获取当前的路径 //例如:文件路径为: //D:/phpweb/demo/test.php //test.php内容为: echo "hi"; //D:/phpweb/index.php //index.php内容为: set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE…
朋友们 开发的时候 ,总会 遇到 include_once()的情况.有时候,我们需要大量的引用文件,但是被引用文件的路径有时候是个问题.  我们可以把 经常要引用 的文件,放在一个 文件夹中,我们取名为include,这样 我们 就把 该文件夹 当做 默认的引用路径. 我们可以 用 set_include_path() 来设定,多个路径 可以用 路径分隔符分开(windows为';',linux为':'). 例: define('INCLUDE_PATH','/include/'); set_…
首先 我们来看这个全局变量:__FILE__ 它表示文件的完整路径(当然包括文件名在内) 也就是说它根据你文件所在的目录不同,有着不同的值:当然,当它用在包行文件中的时候,它的值是包含的路径: 然后: 我们看这个函数: string dirname ( string path ) 它是PHP内置函数,它的作用是什么呢,就是返回除了本文件名以外的所在目录,给你举个例子 假如你的首页中用到了_FILE_这个变量: (假设你的网页所在目录为:),那么: _FILE_的值为(一个绝对路径).而此时 di…
本文实例分析了PHP中spl_autoload_register()函数用法.分享给大家供大家参考,具体如下: 在了解这个函数之前先来看另一个函数:__autoload. 一.__autoload 这是一个自动加载函数,在PHP5中,当我们实例化一个未定义的类时,就会触发此函数.看下面例子: printit.class.php: 1 2 3 4 5 6 7 <?php class PRINTIT {  function doPrint() {  echo 'hello world';  } }…
zendframework的示例index.php里有这样一句 set_include_path('.' . PATH_SEPARATOR . '../library/'. PATH_SEPARATOR . './application/models/'. PATH_SEPARATOR . './application/lib/'. PATH_SEPARATOR . get_include_path()); 不知道 PATH_SEPARATOR是什么,其实就是一个常量 直接echo就知道它的值了…
说明 string set_include_path ( string $new_include_path ) 为当前脚本设置 include_path 运行时的配置选项. 参数 new_include_path include_path 新的值. 返回值 成功时返回旧的 include_path 或者在失败时返回 FALSE. 范例 Example #1 set_include_path() 例子 <?php// 自 PHP 4.3.0 起可用set_include_path('/usr/li…
string set_include_path ( string $new_include_path ) 为当前脚本设置 include_path 运行时的配置选项. Example #2 添加到include path 利用常量 PATH_SEPARATOR 可跨平台扩展 include path. 这个例子中我们把 /usr/lib/pear 添加到了 现有的 include_path 的尾部. <?php$path = '/usr/lib/pear';set_include_path(ge…