3
我有一個控制檯路線我module.config.php文件在Zend3控制檯路線不匹配
'console' => [
'router' => [
'routes' => [
'remove' => [
'type' => 'simple',
'options' => [
'route' => 'remove [force] [init]',
'defaults' => [
'controller' => Controller\CliController::class,
'action' => 'remove',
],
],
]
]
]
]
我的控制器,具有方法removeAction()
namespace Controller;
class CliController extends AbstractActionController
{
public function removeAction()
{
$this->logger->debug('I am in');
}
}
當我命令php public/index.php remove force
或php public/index.php remove
我從來沒有發送過去做控制器,沒有錯誤或任何輸出。那麼我在做匹配錯誤?
這就像應用程序沒有意識到它是從終端調用。有時候,如果我從我的module/MyModulefolder
中的Module.php
中刪除getConfig
方法,則返回html
。
在我的情況下,我必須安裝zend控制檯之前,並添加到module.config.php,如你所說。安裝使用作曲家需要zendframework/zend-mvc-控制檯 –