0
Basically, I have 3 files located in different directories:
diretorio_do_projeto/classes/config.php
diretorio_do_projeto/classes/abstract/abstract-dao.php
diretorio_do_projeto/classes/dao/modelo-dao.php
The archive config.php
sets constants for database access, and is included in the file abstract-dao.php
, which in turn is included in the file modelo-dao.php
.
The problem occurs when I include the file modelo-dao.php
on some page that is not in a subdirectory of /classes
, the file abstract-dao.php
is not found.
There is a different way to import a class other than via commands require
or include
?
The only solutions I could think of were to remove imports in the classes and import them one by one on the page where I will use them, or leave them in the same directory on the page.
You have already researched autoloads (http://php.net/manual/en/language.oop5.autoload.php) and namespaces (http://php.net/manual/en/language.namespaces.php)?
– gmsantos