Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/rust/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php zend框架控制器停止工作_Php_Zend Framework - Fatal编程技术网

Php zend框架控制器停止工作

Php zend框架控制器停止工作,php,zend-framework,Php,Zend Framework,此索引操作不调用控制器的索引函数: class AboutController extends Zend_Controller_Action { public function init() { /* Initialize action controller here */ } public function indexAction() { $this->getResponse() ->a

此索引操作不调用控制器的索引函数:

class AboutController extends Zend_Controller_Action
{

    public function init()
    {
        /* Initialize action controller here */
    }

    public function indexAction()
    {
      $this->getResponse()
            ->appendBody(' hello from aboutAction');

        $this->_forward( 'nothing','index', null, array( 'email' => 'me@example' ) );  
    }

    public function contactAction()
    {
      $this->view->pageTitle="boolbool";
    }


}
但是nothings索引操作从未被触发..我在about页面中找不到页面..为什么


我甚至无法访问我的nothing控制器,即使它与about(尽管我可以触发about操作)一起存在于文件中。

我认为您的for
$this->\u forward()
参数是错误的:

从Zend Framework的
Zend\u控制器\u操作
类:

class NothingController extends Zend_Controller_Action

{


 public function init()

{

  /* Initialize action controller here */

  }



 public function indexAction()

  {

     $email=$this->_getParam('email','not found');
     $this->getResponse->appendBody('The email is: '.$email ); 
 }




}
所以对你来说应该是:

/**
     * Forward to another controller/action.
     *
     * It is important to supply the unformatted names, i.e. "article"
     * rather than "ArticleController".  The dispatcher will do the
     * appropriate formatting when the request is received.
     *
     * If only an action name is provided, forwards to that action in this
     * controller.
     *
     * If an action and controller are specified, forwards to that action and
     * controller in this module.
     *
     * Specifying an action, controller, and module is the most specific way to
     * forward.
     *
     * A fourth argument, $params, will be used to set the request parameters.
     * If either the controller or module are unnecessary for forwarding,
     * simply pass null values for them before specifying the parameters.
     *
     * @param string $action
     * @param string $controller
     * @param string $module
     * @param array $params
     * @return void
     */
    final protected function _forward($action, $controller = null, $module = null, array $params = null)
    {

问题就在这里。在控制器索引内的两个函数中:$email=$this->_getParam('email','notfound')$此->getResponse->appendBody('电子邮件为:'。$email)@DmitryMakovetskiyd也可能是这样,但是您的“_forward()”参数仍然错误,这就是您的页面没有被调用的原因!
this->_forward('index', 'nothing', null, array( 'email' => 'me@example' ))