How do I access the website's root directory in PHP and HTML? [duplicate]

0

One big question I've always had is: How do I access the website's root directory in PHP and HTML?

For example:

If I create a PHP file in the admin folder and need to include a file from the root folder of the site, I'll do it as follows:

include("../arquivo_na_raiz.php");

But, and if I have a PHP file inside the system folder, which is inside the admin folder (../admin/system), I will have to do include as follows:

include("../../arquivo_na_raiz.php");

Do not have a way to go straight to the root folder? No need to put ../ on the front? I think in HTML how to do this, this way:

<!-- Esse <img> irá pegar o arquivo imagem.png que está na pasta raiz -->
<img src="/imagem.png">

If this is not the way it is done in HTML, I am already using it, if you can, to tell me what it is, because I always get confused when I need it. Thanks:)

    
asked by anonymous 15.02.2018 / 00:20

0 answers