I'm trying to write a PHP app and right now I'm having trouble with the include_once()
method. I have a folder structure like this:
/home/header.php
/home/index.php
/home/admin/admin.php
I have no problem accessing header.php from index.php using include_once('/home/header.php');
it works perfectly, but if I try to call include_once()
in admin.php with the same parameters, it crashes.
I want to use absolute paths just so I don't have to worry about where I call the function and all that. Am I doing something wrong with absolute paths? If so, what's the correct way to do it?