php includes is there any way to include a file relative only to that document?

前端 未结 2 1149
青春惊慌失措
青春惊慌失措 2021-02-13 06:48

If I have an index.php file that includes inc/footer.php I would write:

include \'inc/footer.php\';

If I want to include another file inside fo

2条回答
  •  时光说笑
    2021-02-13 07:09

    The best place to find the answer is in the PHP manual.

    http://php.net/manual/en/function.include.php

    Short answer: the path is relative to the executing PHP script no the sub includes.

    Setting a global absolute path to your functions, classes etc folders is the best method.

提交回复
热议问题