开发者

Include 'regular' .php file in symlinked .php file

So, I have a project with config files. When I deploy my code, I don't want the config files of individual servers to be overwritten, do I made a symlink that points to /var/www/config/config.php. That works fine.

Now the problem: config.php requires other .php files, which I do want to deploy. E.g. they're not in /var/www/config, they're in the folder where the symlink sits (/var/www/project/global/config/whatever).

Can I somehow require from the path the symlink is in, instead of the path the symlinked config.php is in?

So basically I want /var/www/config/config.php to include /var/www/project/global/config/file.php when I say require('file.php').

I.e., online separate the one con开发者_如何学Gofig.php from the codebase, not everything it uses.

How can that be done?


http://php.net/manual/en/function.set-include-path.php

Set includes path in PHP

set_include_path(get_include_path() . PATH_SEPARATOR . '/var/www/project/global/config/whatever');
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜