1
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',                    
                            ),
                        ),
                    ),
                ),

                ),
            ),

    ),
);

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

消息:创建“反馈”时引发异常;没有返回实例

消息:缺少参数“PageId”

问题出在哪里?

4

1 回答 1

0

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

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

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

所以它缺少参数Pageid。

尝试这个:

<a href="<?= $this->url('feedback', ['Pageid' => $PageID]) ?>">Feedback</a>
于 2019-08-09T10:20:45.340 回答