Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有很多网站 - 都托管在我的服务器上。我希望其中一个从 /vhost 访问文件,该目录是 httpdocs 上方链接域的目录。
我知道有一个选项可以更改 httpd.conf 中的路径,但要更改我网站中的所有包含项需要做很多工作。
使用函数 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 等。