任何人都知道如何在Zend Framework 2中更改默認模塊?我使用骨架應用程序作爲主頁,但我想創建另一個模塊,使其具有默認主頁。 我想兩件事情如何在Zend Framework 2中爲默認模塊製作自定義模型
我刪除從application.config.php文件中的「框架應用程序」這是它看起來像
return array(
'modules' => array(
'Application',
'Helloworld'
),
'module_listener_options' => array(
'config_glob_paths' => array(
'config/autoload/{,*.}{global,local}.php',
),
'module_paths' => array(
'./module',
'./vendor',
),
),
);
這是它看起來像現在
return array(
'modules' => array(
'Helloworld'
),
'module_listener_options' => array(
'config_glob_paths' => array(
'config/autoload/{,*.}{global,local}.php',
),
'module_paths' => array(
'./module',
'./vendor',
),
),
);
如果你不能告訴我從模塊 刪除'應用程序'然後我改變了我的module.config.php文件的Helloworld模塊 這裏是它看起來像
return array(
'view_manager' => array(
'template_path_stack' => array(
__DIR__ . '/../view',
),
),
'router' => array(
'routes' => array(
'sayhello' => array(
'type' => 'Zend\Mvc\Router\Http\Literal',
'options' => array(
'route' => '/sayhello',
'defaults' => array(
'controller' => 'Helloworld\Controller\Index',
'action' => 'index',
)
)
)
)
),
'controllers' => array(
'factories' => array(
'Helloworld\Controller\Index' => 'Helloworld\Controller\IndexControllerFactory'
)
),
'service_manager' => array(
'invokables' => array(
'greetingService' => 'Helloworld\Service\GreetingService'
)
)
);
這是它看起來像現在
return array(
'view_manager' => array(
'template_path_stack' => array(
__DIR__ . '/../view',
),
),
'router' => array(
'routes' => array(
'sayhello' => array(
'type' => 'Zend\Mvc\Router\Http\Literal',
'options' => array(
'route' => '/',
'defaults' => array(
'controller' => 'Helloworld\Controller\Index',
'action' => 'index',
)
)
)
)
),
'controllers' => array(
'factories' => array(
'Helloworld\Controller\Index' => 'Helloworld\Controller\IndexControllerFactory'
)
),
'service_manager' => array(
'invokables' => array(
'greetingService' => 'Helloworld\Service\GreetingService'
)
)
);
的變化是在選項的「路由器」陣列製成=>路線,我改變了價值,只是「/」
但它會拋出一個5000錯誤 任何人都可以詳細說明我做錯了什麼?
現在我記得爲什麼我切換到Symfony ... – mpm
你是否已將'Application'文件夾更名爲'src'文件夾中的'Helloworld'?它必須解決你的路由問題 – tawfekov
謝謝你的回覆。我想我只是不明白如何模板默認工作,他們基本上級聯。這就是爲什麼我沒有在我的Hello World中創建佈局而離開的原因,只要「骨架應用程序」在那裏也可以工作。 –