开发者

change path for include/require only once

开发者 https://www.devze.com 2022-12-18 10:15 出处:网络
I have a lot of sites - all hosted on my server. I want one of them to access file from /vhos开发者_高级运维t which is a directory above httpdocs where the domain is linked.

I have a lot of sites - all hosted on my server. I want one of them to access file from /vhos开发者_高级运维t which is a directory above httpdocs where the domain is linked.

I know that there is an option to change the path in httpd.conf but that is a lot of work to change all the includes in my sites.


Use the function ini_set(). For example if you wanted to set your PHP include_path to ".:../:./include:../include" then you would do this in your PHP code:

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

You can also use ini_set() to affect other PHP settings like auto_prepend_file, auto_append_file, error_reporting, etc.

0

精彩评论

暂无评论...
验证码 换一张
取 消