-2

有没有一种简单的方法来管理 php.ini 中的依赖项。我已将 php 文件分成不同的文件夹。有时它们会在彼此之间互换。即使我使用绝对形式,require_once 语句也会发生变化。我很好奇是否有人知道解决此问题的简单方法。

4

2 回答 2

3

使用相对路径require_once停止在文件夹之间移动文件

于 2012-12-11T02:57:32.823 回答
0

The best thing to do is to keep your includes all in one folder or the base directory. When you require_once a file inside of a file you yourself are requireing (like a chain), the path of the require in the later chain will eventually break if files are spread out. Instead, keep includes together and you should have no problem.

Hope this helps!

Edit: Also, if you have to have includes in different folders, make copies and keep those copies in folders. It is not the best strategy because files may need updates and i know i dont wanna copy and paste a file 10 times.

于 2012-12-11T03:10:02.073 回答