缺少参数 zf2


Missing parameter zf2

return array(
    'feedback_captcha' => array(
        'class' => 'image',
        'options' => array(
            // using tmp sys dir to generate Captcha images
            'imgDir' => sys_get_temp_dir(),
            // feel free to add fonts in Module's font directory
            'fontDir' => __DIR__.'/../../../data/Fonts',
            // if 'font' is not defined, SanCaptcha Module, will pick one randmoly in 'fontDir'
             'font' => 'arial.ttf',
            'width' => 200,
            'height' => 50,
            'dotNoiseLevel' => 40,
            'lineNoiseLevel' => 3
        ),
    ),
    'controllers' => array(
        'invokables' => array(
            'Feedback'Controller'Captcha' => 'Feedback'Controller'CaptchaController',
            'Feedback'Controller'Feedback' => 'Feedback'Controller'FeedbackController'
        ),
    ),

    'router' => array(
        'routes' => array(
            'Feedback' => array(
                'type'    => 'Literal',
                'options' => array(
                    'route'    => '/feedback',
                    'defaults' => array(
                        'controller'    => 'Feedback'Controller'Feedback',
                        'action'        => 'index',
                    ),
                ),
                ),
                 'Feedback' => array(
                'type'  => 'Zend'Mvc'Router'Http'Segment',
                'options' => array('route' => '/feedback[/:action][/:PageId]',
                    'constraints' => array(
                    'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
                    'PageId' =>  '[0-9]+',
                    ),
                    'defaults' => array(
                    'controller' => 'Feedback'Controller'Feedback',
                    'action' => 'index',
                    ),
                ),
                'may_terminate' => true,
                'child_routes' => array(
                    'captcha_form' => array(
                        'type'    => 'Zend'Mvc'Router'Http'Segment',
                        'options' => array(
                            'route'    => '/[:action[/]]',
                             'constraints' => array(
                                'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
                            ),
                            'defaults' => array(
                                'action' => 'index',                     
                            ),
                        ),
                    ),
                    'captcha_form_generate' => array(
                        'type'    => 'segment',
                        'options' => array(
                            'route'    =>  '/captcha/[:id]',
                            'defaults' => array(
                                'controller' => 'Feedback'Controller'Captcha',
                                'action' => 'generate',                    
                            ),
                        ),
                    ),
                ),
                ),
            ),
    ),
);

我的反馈模块有以下配置,当我尝试转到该模块时,出现以下错误:

消息:创建"反馈"时引发异常;未返回任何实例

消息:缺少参数"页面 ID">

问题出在哪里?

这很旧,但也许有些人有类似的问题。

也许您在页面上的某个地方有错误的代码,例如:

<a href="<?= $this->url('feedback') ?>">Feedback</a> 

所以它缺少参数页面ID。

试试这个:

<a href="<?= $this->url('feedback', ['Pageid' => $PageID]) ?>">Feedback</a>