我正在开发一个php应用程序。 我有很多类和文件分为不同的目录。 我有一个配置文件，其中包含
require code>的数据库连接设置和文件。 例如：
需要“core / application.php” code>，我为所有类和文件执行此操作。
config.php code>也会创建我的对象。 我试图在我的所有文件中都要求
config.php code>中的对象，但它尝试创建另一个对象，我得到了 错误说该对象已存在。 我还试图创建一个
init（） code> 已经存在。 我试图自动加载我的课程，但我认为这不会起作用。 过去几天我一直在尝试不同的事情，但我无法弄明白。 我也不想把我的类传给对象。 感谢您的帮助。 p>
I am working on a php application. I have many classes and files divided into different directories. I have a config file that holds the database connection settings and files with
require. For example:
require "core/application.php" and I do this for all my classes and files.
config.php also creates my objects. I tried to require
config.php in all my files so that my classes would have access to the objects in
config.php but it tries to create another object and I get and error saying that the object already exists. I also tried to create an
init() function and call it in my
index.php but then I get an error saying that
init() already exists. I was trying to auto load my classes but I don't think that is going to work. I have been trying different things for the past few days but I cannot figure anything out. I also don't want to pass my classes the objects. Thank you for the help.