Answer the question
In order to leave comments, you need to log in
When creating a new module in ZF 3, it says that there is no such class, how to solve this problem?
When creating a new module, let's say Blog, and all the settings (module.config.php | Module.php) and creating an IndexController, it writes an error that the Blog\Controller\IndexController
Fatal error class, although the IndexController file itself exists and is located in the Blog/src/Controller/ folder
<?php
namespace Blog\Controller;
use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;
class IndexController extends AbstractActionController
{
public function indexAction()
{
return new ViewModel();
}
}
<?php
namespace Blog;
use Zend\Router\Http\Segment;
use Zend\ServiceManager\Factory\InvokableFactory;
return [
'controllers' => [
'factories' => [
Controller\IndexController::class => InvokableFactory::class,
],
],
'router' => [
'routes' => [
'blog' => [
'type' => Segment::class,
'options' => [
'route' => '/blog',
'defaults' => [
'controller' => Controller\IndexController::class,
'action' => 'index',
],
],
],
],
],
'view_manager' => [
'template_path_stack' => [
__DIR__ . '/../view',
],
],
];
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question