我正在尝试使用控制台从我的控制器访问一个功能.这是一个小应用程序,所以我只有一个控制器,'IndexController'.我想要达到的行动是'buildSchemeAction'.
据我所知,你必须在你的"module.config.php"文件中添加路由,我按照以下步骤操作:
return array(
'console' => array (
'router' => array (
'routes' => array (
'build-scheme' => array (
'options' => array (
'route' => 'build-scheme',
'defaults' => array (
'controller' => 'Application\Controller\Index',
'action' => 'build-scheme'
)
)
)
)
)
), ..//
Run Code Online (Sandbox Code Playgroud)
我的控制器功能如下所示:
public function buildSchemeAction()
{
// logic here
}
Run Code Online (Sandbox Code Playgroud)
当我在控制台中输入以下内容时:
php index.php build-scheme
Run Code Online (Sandbox Code Playgroud)
我得到:
Zend Framework 2.2.5 application
Usage:
Reason for failure: Invalid arguments or no arguments provided
Run Code Online (Sandbox Code Playgroud)
我一直在网上搜索,但找不到任何东西.我错过了什么吗?