Answers for "php how to get file name"

PHP
11

php get file extension from filename

$ext = pathinfo($filename, PATHINFO_EXTENSION);
Posted by: Guest on October-26-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

Browse Popular Code Answers by Language