在Symfony2中,我看到了如下代码:
if (null === $this->rootDir) {
$r = new \ReflectionObject($this);
$this->rootDir = dirname($r->getFileName());
}
Run Code Online (Sandbox Code Playgroud)
为什么不只是使用__DIR__?
if (null === $this->rootDir) {
$this->rootDir = __DIR__;
}
Run Code Online (Sandbox Code Playgroud)
他们之间有什么区别?
| 归档时间: |
|
| 查看次数: |
711 次 |
| 最近记录: |