Zend framework2 PHP致命错误:类';相册\控制器\相册控制器';在zf2中找不到
我希望有人能帮我 我正在学习Rob Allen的Zend Framework 2教程 当我尝试去: 我在apache的日志中发现以下错误(我使用Zend Server CE免费版本): PHP致命错误:在C:\Program Files\Zend\Apache2\htdocs\zf2 tutorial\vendor\zendframework\zendframework\library\Zend\ServiceManager\AbstractPluginManager.PHP的第175行中找不到类“Album\Controller\AlbumController” module\Album\module.config.phpZend framework2 PHP致命错误:类';相册\控制器\相册控制器';在zf2中找不到,zend-framework2,Zend Framework2,我希望有人能帮我 我正在学习Rob Allen的Zend Framework 2教程 当我尝试去: 我在apache的日志中发现以下错误(我使用Zend Server CE免费版本): PHP致命错误:在C:\Program Files\Zend\Apache2\htdocs\zf2 tutorial\vendor\zendframework\zendframework\library\Zend\ServiceManager\AbstractPluginManager.PHP的第175行中找不
<?php
return array(
'controllers' => array(
'invokables' => array(
'Album\Controller\Album' => 'Album\Controller\AlbumController'
),
),
'router' => array(
'routes' => array(
'album' => array(
'type' => 'segment',
'options' => array(
'route' => '/album[/:action][/:id]',
'constraints' => array(
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
'id' => '[0-9]+',
),
'defaults' => array(
'controller' => 'Album\Controller\Album',
'action' => 'index',
),
),
),
),
),
'view_manager' => array(
'template_path_stack' => array(
'album' => __DIR__ . '/../view'
)
)
);
您是否配置了自动加载器?(例如,模块类中的getAutoloaderConfig()
)是的,我有。公共函数getAutoloadConfig(){返回数组('Zend\Loader\ClassMapAutoloader'=>array(DIR./autoload_classmap.php',),'Zend\Loader\StandardAutoloader'=>array('namespaces'=>array(NAMESPACE=>DIR./src/'.NAMESPACE,)哦,天哪。getAutoloaderConfig()不是getAutoloaderConfig(),这是工作。谢谢你的帮助!
<?php
namespace Album\Controller;
use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;
class AlbumController extends AbstractActionController
{
protected $albumTable;
public function getAlbumTable()
{
if (!$this->albumTable) {
$sm = $this->getServiceLocator();
$this->albumTable = $sm->get('Album\Model\AlbumTable');
}
return $this->albumTable;
}
public function indexAction()
{
return new ViewModel(array(
'albums' => $this->getAlbumTable()->fetchAll(),
));
}
public function addAction()
{
}
public function editAction()
{
}
public function deleteAction()
{
}
}