ZF2: How can I set basePath to be the same for a w

2019-07-29 06:43发布

问题:

The manual's example shows how to set the basePath only for some specific viewModel:

$this->getHelper('basePath')->setBasePath()

But I want to set it somewhere in one place and then it is the same for any viewModel I create in any Controller. How can I do it?

回答1:

You could set a global base path in config:

'view_manager' => array(
    'base_path' => '/path/'
)