Search code examples
phpincludeinclude-path

How to include php pages in same or different folders?


How can I include the PHP pages if they are in same or different folders without writing full path?


Solution

  • If it's the same folder:

    include 'filename.php';
    

    If it's a parent folder;

    include '../filename.php`
    

    if it's a folder with the same parent:

    include '../foldername/filename.php;`