-2
In the archive usuario_class.php
, on line 2, change require "../core/conecta.php"
for require __FILE__ . "/../core/conecta.php"
.
Basically the constant __FILE__
returns the directory of the file where it was declared (and not of the file where it was included) which in this case would be exemplo_2/class
. Then the require would look similar to require "exemplo_2/class/../core/conecta.php"
. That is from the folder class
a directory would be uploaded (it would be inside the example folder), and it would be possible to access the core folder.
The same does not happen in the original require (require "../core/conecta.php"
), because the relative paths are made in relation to the archive index.php
(who was the one who included the file usuario_class.php
). In that case, playing the require would be require "exemplo_2/../core/conecta.php"
. That is, in this situation the core folder should be out of exemplo_2.
Wrong way wrong
– user60252