📜  php 获取文件位置 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:53:55.330000             🧑  作者: Mango

代码示例1
# 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;
}