私はzend framework 3のスケルトンチュートリアルに従っています。Zend Framework 3スケルトン2モジュール
私は最初、標準のzend画面への歓迎を示すアプリケーションモジュールを手に入れました。
私がアルバムモジュールを追加したとき、すべてうまくいった。私のURLにある/ albumに移動すると、アルバムのセクションがすべて表示されます。しかし、アプリケーションのセクションに戻るためにURLの最後から/ albumを削除すると、次の404ページが表示されます。
**A 404 error occurred**
Page not found.
The requested controller could not be mapped to an existing controller class.
Controller:
ApplicationController (resolves to invalid controller class or alias:
ApplicationController)
No Exception available
私のコードのいくつかのセクションが表示されますが、分かりましたが、どのファイルがこれを引き起こしているのか分かりません。誰かがこの問題の原因となっている設定ファイルを教えてもらえればアップロードできます。私はそれがルーティングされているとはかなり確信していますが、ZF1から来るのは頭の傷つきやすい人です。
誰かが私に助けてくれると私に説明することができたら、私はとても感謝しています。
更新 以下は、自分のアプリケーションモジュール用のmodule.config.phpです。
<?php
/**
* @link http://github.com/zendframework/ZendAlbumApplication for the canonical source repository
* @copyright Copyright (c) 2005-2016 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
namespace Application;
use Zend\Router\Http\Literal;
use Zend\Router\Http\Segment;
use Zend\ServiceManager\Factory\InvokableFactory;
return [
'router' => [
'routes' => [
'home' => [
'type' => Literal::class,
'options' => [
'route' => '/',
'defaults' => [
'controller' => \ApplicationController::class,
'action' => 'index',
],
],
],
'application' => [
'type' => Segment::class,
'options' => [
'route' => '/application[/:action]',
'defaults' => [
'controller' => Controller\IndexController::class,
'action' => 'index',
],
],
],
],
],
'controllers' => [
'factories' => [
Controller\IndexController::class => InvokableFactory::class,
],
],
'view_manager' => [
'display_not_found_reason' => true,
'display_exceptions' => true,
'doctype' => 'HTML5',
'not_found_template' => 'error/404',
'exception_template' => 'error/index',
'template_map' => [
'layout/layout' => __DIR__ . '/../view/layout/layout.phtml',
'application/index/index' => __DIR__ . '/../view/application/index/index.phtml',
'error/404' => __DIR__ . '/../view/error/404.phtml',
'error/index' => __DIR__ . '/../view/error/index.phtml',
],
'template_path_stack' => [
__DIR__ . '/../view',
],
],
];
?>
私はそれがスケルトンZend Frameworkにウェルカムページを表示URLで/アプリケーションと/アルバムを置き換えるUPDATE 2。このページはちょうどhttp://localhostと表示されると思いましたか?私はポイントを逃しているのですか?または、アプリケーションモジュールをデフォルトモジュールにして、URLの最後に/アプリケーションを追加する必要はありませんか?
モジュール/アプリケーション/ config.phpを表示できます –
オリジナルの投稿を更新しました。 – WayneP
URLに/ applicationを追加したところ、zend frameworkのページが表示されます。私は、このページが、アプリケーション・ビットがURLに追加されていないときに表示することを期待していましたか? – WayneP