问题
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/'
)
来源:https://stackoverflow.com/questions/13955426/zf2-how-can-i-set-basepath-to-be-the-same-for-a-whole-application