When I use an architecture like MVC in a PHP project separating the models
, controllers
, services
, views
many times using the include
or require
functions the application loses itself when importing the PHP files located in other directories, and for this you need to pass the full disk path of the file location in order to prevent a PHP file inside the model
directory being imported from being searched in /controllers/model
where this problem often occurs when returning directories ( ../
) for example.
I would like to know if you can import these files using the URL instead of the disk path because you do not have to keep going back and forth in each directory.
So you could import simply by passing: /controllers/TerceiroController.class
, for example, or localhost/projeto/controllers/TerceiroController.class
instead of /var/www/html/...