Zend Reader 不工作,文件不可读

Zend Reader doesn't work, file is not readable

嘿,有人知道为什么 Zend Reader 不想读取我需要的文件吗?

FooController.php :

$reader = new Zend\Config\Reader\Ini();
$data = $reader->fromFile("application.ini");

Application.iniFooController 目录中。

Reader returns 错误:- File 'application.ini' doesn't exist or not readable

但如果我尝试

require_once('application.ini)  

包含文件

是的,因为您没有指定文件的完整路径。 如果文件在同一目录中,您可以使用它

$reader = new Zend\Config\Reader\Ini();
$data   = $reader->fromFile(__DIR__."application.ini");

如果文件在不同的目录中,则这样

realpath(APPLICATION_PATH ."YOUR_PATH")