Answers for "how to get directory location of file in php"

PHP
2

dir name php

<?php
dirname(__FILE__);
?>
Posted by: Guest on July-04-2020
0

php get file location

# C:\Users\Redacted\Desktop\main.php
include __DIR__ . DIRECTORY_SEPARATOR . 'include.php';
echoScriptPath();

# C:\Users\Redacted\Desktop\include.php
function echoScriptPath() {
    list($scriptPath) = get_included_files();
    echo 'The script being executed is ' . $scriptPath;
}
Posted by: Guest on June-19-2020

Code answers related to "how to get directory location of file in php"

Browse Popular Code Answers by Language