在查看phpunit代码看是如何加载phpunit的配置文件的,发下在调用 file_exsits()函数时在前面加了一个反斜杠“\”,代码如下:
if (isset($this->arguments['configuration']) &&
\is_dir($this->arguments['configuration'])) {
$configurationFile = $this->arguments['configuration'] . '/phpunit.xml';
if (\file_exists($configurationFile)) {
$this->arguments['configuration'] = \realpath(
$configurationFile
);
} elseif (\file_exists($configurationFile . '.dist')) {
$this->arguments['configuration'] = \realpath(
$configurationFile . '.dist'
);
}
} elseif (!isset($this->arguments['configuration']) &&
$this->arguments['useDefaultConfiguration']) {
if (\file_exists('phpunit.xml')) {
$this->arguments['configuration'] = \realpath('phpunit.xml');
} elseif (\file_exists('phpunit.xml.dist')) {
$this->arguments['configuration'] = \realpath(
'phpunit.xml.dist'
);
}
}
if (\file_exists('phpunit.xml')) 这个时什么意思?能到指定从根目录查找“phpunit.xml”文件吗?;
1 回答
绝地无双
TA贡献1946条经验 获得超4个赞
PHP在表示命名空间的时候会用到反斜杠,此处的单个反斜杠就是表示在当前命名空间内调用全局的方法,具体可以看看命名空间相关资料。
file_exists(path)
这是用法,就是在指定路径查找文件是否存在。
- 1 回答
- 0 关注
- 787 浏览
添加回答
举报
0/150
提交
取消