Folder Structure
- root
- inc/
- db.php
- session.php
- db.php
- init.php
- lib/
- Twig/
- inc/
- init.php
login.php file
<?php
include 'inc/init.php';
init.php
<?php
include 'session.php';
$config = include 'config.php';
include 'db.php';
require_once '/lib/Twig/Autoloader.php';
Twig_Autoloader::register();
What I’m so confused about is the fact that the Twig library gets included. Shouldn’t I need to back a folder ../ ? But that is giving me an error, and I simply don’t understand why.
You are using absolute path for Twig, this is why it is included. If you want to include it from your
init.phpfile using relative path, then it should be like this: