I have the following directory structure.
/var/www/base/controller/detail.php
/var/www/base/validate/edit.json
/var/www/html
Within /
You can always try to do the opposite first to find out:
file_put_contents('FINDME', 'smth');
exit();
$json=file_get_contents('detail.php');
...
Then run something like this from your terminal on *nix system (or search for a file named FINDME using GUI on Windows)
find -name 'FINDME'
The command will output something like this:
//FINDME
Now you know the root dir (from which the relative path is being taken) for the file where you are attempting to read the other files and you can construct the relative path easily