Zend Frame Work Cron Error

时间:2015-03-06 15:51:37

标签: php zend-framework cron zend-framework2

我的第二个cron动作(sendDailyRecap)有效但是我也收到一封电子邮件通知我一个错误。

错误消息:

Zend Framework 2.3.3 application
Usage:

Reason for failure: Invalid arguments or no arguments provided

我认为问题出在我的module.config文件中。任何想法为什么我收到错误(当工作正确执行)?我想修复此问题,以便我不再收到错误电子邮件。感谢

module.config

<?php
return array(
    'controllers' => array(
        'invokables' => array(
            'Cron\Controller\CronController' => 'Cron\Controller\CronController',
        ),
    ),
    'console' => array(
        'router' => array(
            'routes' => array(
                'cronroute' => array(
                    'options' => array(
                        'route'    => 'sendTest',
                        'defaults' => array(
                            'controller' => 'Cron\Controller\CronController',
                            'action' => 'index'
                        ),
                        'route'    => 'sendDailyRecap',
                        'defaults' => array(
                            'controller' => 'Cron\Controller\CronController',
                            'action' => 'sendDailyRecap'
                        ),
                    )
                )
            )
        )
    )
);

Cron Command

/usr/bin/php-cli /home/financialfriend/public_html/public/index.php sendDailyRecap

/usr/bin/php-cli /home/financialfriend/public_html/public/index.php sendTest

1 个答案:

答案 0 :(得分:0)

需要退一步。

'console' => array(
    'router' => array(
        'routes' => array(
            'sendReminder' => array(
                'options' => array(
                    'route'    => 'sendReminder',
                    'defaults' => array(
                        'controller' => 'Cron\Controller\CronController',
                        'action' => 'sendReminder'
                        ),
                )
            ),
            'sendRecap' => array(
                'options' => array(
                    'route'    => 'sendDailyRecap',
                    'defaults' => array(
                        'controller' => 'Cron\Controller\CronController',
                        'action' => 'sendDailyRecap'
                        ),
                )
            )
        )
    )
)
);