ZF2:如何在整个应用程序中将basePath设置为相同? [英] ZF2: How can I set basePath to be the same for a whole application?

查看:116
本文介绍了ZF2:如何在整个应用程序中将basePath设置为相同?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

本手册的示例显示了如何仅为某些特定的viewModel设置basePath:

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

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

但是我想将它设置在某个地方,然后对于我在任何Controller中创建的任何viewModel来说都是一样的.我该怎么办?

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?

推荐答案

您可以在config中设置全局基本路径:

You could set a global base path in config:

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

这篇关于ZF2:如何在整个应用程序中将basePath设置为相同?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆