Include in file with include

Asked

Viewed 2,100 times

0

I own a file that makes one include from a file, which is in a different folder, which in turn makes another include from another file which is also in a different folder.

This is the include:

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

A file that is inside the folder "1998" realizes include do header.php which is in the parent folder and the header.php makes include of connection.php, modal.php and page_verify.php that are in the folder "shares", but the following errors are issued:

Warning: include_once(../acoes/conexao.php): failed to open stream: No such file or directory in C: xampp htdocs PMI-WEB-CONTAB-ALPHA pages header.php on line 5

Warning: include_once(): Failed Opening '.. /acoes/conexao.php' for inclusion (include_path='C: Xampp php PEAR') in C: xampp htdocs PMI-WEB-CONTAB-ALPHA pages header.php on line 5

Warning: include_once(../acoes/modal.php): failed to open stream: No such file or directory in C: xampp htdocs PMI-WEB-CONTAB-ALPHA pages header.php on line 6

Warning: include_once(): Failed Opening '.. /acoes/modal.php' for inclusion (include_path='C: Xampp php PEAR') in C: xampp htdocs PMI-WEB-CONTAB-ALPHA pages header.php on line 6

Warning: require(../acoes/pagina_verificar.php): failed to open stream: No such file or directory in C: xampp htdocs PMI-WEB-CONTAB-ALPHA pages header.php on line 11

Fatal error: require(): Failed Opening required '.. /acoes/pagina_verify.php' (include_path='C: Xampp php PEAR') in C: xampp htdocs PMI-WEB-CONTAB-ALPHA pages header.php on line 11

1 answer

1


All the includes calls must have the same relative path as the parent file.

If you did include "../header.php", all includes within header.php should be include "../../acoes/arquivo.php"

So in your code when you use include "../acoes/pagina_verificar.php" you’re trying to access pages/shares/page_verify.php instead of acoes/pagina_verify.php

  • I did more or less that there, but I put the complete path in header.php. Only that I came up with a new problem, it seems that bootstrap and css are not getting

Browser other questions tagged

You are not signed in. Login or sign up in order to post.