dimanche 12 août 2018

Get directory of the file which included another file in PHP

I got two files:

get_path.php:

function get_path() {
    echo basename(__FILE__); 
}

main.php

require("get_path.php");

get_path();
// This echos out "get_path.php", however i want it to echo out main.php

Does somebody know how to achieve this?

Thank you very much in advance!




Aucun commentaire:

Enregistrer un commentaire