【问题标题】:Extra folder in controllers in Zend FrameworkZend Framework 控制器中的额外文件夹
【发布时间】:2012-07-04 14:53:00
【问题描述】:

我想在控制器中添加一个新目录。我不想创建模块或其他东西。我的结构是这样的:

application
    controllers
        connections
    models
    ...

我希望能够将任何控制器添加到连接中以便我可以使用它。

哦,连接内的控制器只会被

使用
// forward to an action in another controller:
// FooController::bazAction(),
// in the current module:
$this->_forward('baz', 'foo', null, array('baz' => 'bogus'));

我的问题是我必须向引导程序(或其他任何地方)添加什么才能使用这些控制器?

我不断收到错误消息:控制器无效

【问题讨论】:

标签: php zend-framework frameworks


【解决方案1】:

考虑以下结构:

application
    controllers
        Connection  (with a capitalized C and no S)
    models
    ...

您可以使用以下方式转发给控制器:

// forward to an action in another controller:
// Connection_FooController::bazAction(),
// in the current module:
$this->_forward('baz', 'connection_foo', null, array('baz' => 'bogus'));

【讨论】:

  • 天哪。除了用大写 C 写连接外,我什么都试过了。谢谢。它有效
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-06-23
  • 2022-07-26
相关资源
最近更新 更多