开发者

how to include file from child directory in php

My file lies in /var/www/spywgc/adm/index.php folder .... and the file i want to include lies in var/www/spywgc/adm/rpt/lib_pivot.php

I want to include lib_pivot.php in index.php..... The lib_pivot.php interns include a 开发者_开发问答file var/www/spywgc/lib_gen file.....

I wrote a syntax of in index.php file... but, it keeps giving me error....

Someone please explain me what to do.


include('rpt/lib_pivot.php'); will work, unless there's something I'm misunderstanding.

When you call include(), and don't begin with a '/', it starts in the directory of the caller script. So if index.php is in adm/, then just progress from inside adm/ further down the path.

Section 2

If I understand this correctly (it's kind of confusing):

The lib_pivot.php interns include a file var/www/spywgc/lib_gen file

then inside of lib_pivot.php use include('../../lib_gen.php'); to come up two directories from the rpt/ directory.


Well it's hard to solve without you telling us the actual error, but this should work

include('/var/www/spywgc/adm/rpt/lib_pivot.php');

If anything you might have been missing the "/" at the start of the string


You have no showed the include() statement that resides on line 1 inside of lib_pivot.php...thats where you error is comming from

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜