How to include a file that is inside another directory

My file is located in the /var/www/spywgc/adm/index.php .... folder and the file I want to include is in var / www / spywgc / adm / rpt / lib_pivot.php

I want to include lib_pivot.php in index.php ..... Internships in lib_pivot.php include the file var / www / spywgc / lib_gen .....

I wrote the syntax <?php require_once('./rpt/lib_pivot.php'); ?>in the index.php file ... but, it continues to give me an error ....

Someone please explain to me what to do.

+3
source share
4 answers

close. try:

<?php require_once('../rpt/lib_pivot.php'); ?>
+3
source

require_once ('/var/WWW/spywgc/RPT/lib_pivot.php');

sorts you maybe. that is, the full path, not relative.

0
source
<?php require_once('../rpt/lib_pivot.php'); ?>
0
<?php require_once(dirname(__FILE__) . '/rpt/lib_pivot.php'); ?>

lib_pivot.php , __FILE__.

The elders lib_pivot.php have a file var / www / spywgc / lib_gen .....

Is this lib_gen.php?

lib_pivot.php should also include for example

require_once(dirname(__FILE__) . '/rpt/lib_gen.php');
0
source

Source: https://habr.com/ru/post/1784821/


All Articles