在php中需要一次发布

在php中需要一次发布,php,pear,require-once,Php,Pear,Require Once,我正在使用xampp开发我的php应用程序。几天前,我安装了pear ti使用DB抽象。之后,我不能使用来自父目录的include文件,但是我可以使用来自子目录的include文件 下面是我在检查include路径时看到的内容 )。;E:\xampp\php\PEAR 我尝试使用set_include_path将include path更改为存储文件的位置,然后应用程序无法加载Pear文件 非常感谢您的帮助。如果您真的想使用set\u include\u path,您可以这样做: set_inc

我正在使用xampp开发我的php应用程序。几天前,我安装了pear ti使用DB抽象。之后,我不能使用来自父目录的include文件,但是我可以使用来自子目录的include文件

下面是我在检查include路径时看到的内容

)。;E:\xampp\php\PEAR

我尝试使用set_include_path将include path更改为存储文件的位置,然后应用程序无法加载Pear文件


非常感谢您的帮助。

如果您真的想使用set\u include\u path,您可以这样做:

set_include_path(get_include_path().PATH_SEPARATOR.'path_to_parent');
如果代码移动到使用不同目录分隔符的服务器,请使用预定义的常量目录分隔符

就我个人而言,如果我需要专门为某个特定站点设置路径,我会尝试在该站点的web根目录中的.htaccess文件中设置路径。它提供了一个更明显的位置来查找站点范围的配置,如include_路径。以下是您将放入.htaccess文件的行:

php_value include_path ".;E:\xampp\php\PEAR;path_to_parent"
或在Linux服务器上:

php_value include_path ".:some_path/PEAR:path_to_parent"

添加到包含路径堆栈的最简单方法是

set_include_path(implode(PATH_SEPARATOR, array(
    'path/to/app/includes',
    'path/to/any/other/includes',
    get_include_path()
)));

如何包含这些文件?@deceze我试图包含的文件位于/htdocs/sms/application/configs/application.php中,我从/htdocs/sms/cce_desc/index.php调用此文件,代码为require_once.“./application/configs/application.php”;感谢您的回复,我已经得到了这个(include_path='E:\xampp\htdocs\sms;;E:\xampp\php\PEAR'),但仍然无法包含文件感谢您的回复,在我的根目录中创建了一个.htaccess文件。这是我的父目录路径“E:\xampp\htdocs\sms”,因此我将avalue设置为以下php\u值include\u路径“;E:\xampp\php\PEAR;E:\xampp\htdocs\sms”。但它不起作用。我将值更改为包含路径“E:\xampp\htdocs\sms”,并且它正在工作。但我需要这两种价值观。