【问题标题】:change path for include/require only once仅更改一次包含/要求的路径
【发布时间】:2011-01-11 10:09:02
【问题描述】:

我有很多网站 - 都托管在我的服务器上。 我希望他们中的一个从 /vhost 访问文件,该目录是 httpdocs 上方的目录,其中链接了域。

我知道有一个选项可以更改 httpd.conf 中的路径,但要更改我网站中的所有包含项需要做很多工作。

【问题讨论】:

    标签: php path include require


    【解决方案1】:

    使用函数 ini_set()。例如,如果您想将 PHP include_path 设置为“.:../:./include:../include”,那么您可以在 PHP 代码中执行此操作:

    ini_set("include_path", ".:../:./include:../include");
    

    您还可以使用 ini_set() 来影响其他 PHP 设置,例如 auto_prepend_file、auto_append_file、error_reporting 等。

    【讨论】:

      猜你喜欢
      • 2014-02-17
      • 1970-01-01
      • 2014-03-12
      • 1970-01-01
      • 2018-12-28
      • 2014-05-14
      • 2012-06-27
      • 1970-01-01
      • 2013-10-10
      相关资源
      最近更新 更多