includeFile()方法是否必要?

时间:2017-09-25 12:54:36

标签: composer-php

我只是好奇为什么官方团队不直接在ClassLoader.php中使用 包含$ file;

提前致谢!

1 个答案:

答案 0 :(得分:0)

code docs非常清楚:

/**
 * Scope isolated include.
 *
 * Prevents access to $this/self from included files.
 */
function includeFile($file)
{
    include $file;
}

它隔离了加载代码,因此无法访问$this$self