ReflectionFunctionAbstract::getFileName()函数用于获取函数所在的文件名。
用法:
ReflectionFunctionAbstract::getFileName(): string|false
参数: 该函数没有参数。
返回值:
示例:
<?php
function myFunction() {
echo "Hello, World!";
}
$reflection = new ReflectionFunction('myFunction');
$filename = $reflection->getFileName();
echo "函数 myFunction() 的文件名是:" . $filename;
?>
输出:
函数 myFunction() 的文件名是:/path/to/myScript.php
注意: