Zend framework2 类别';相册\控制器\相册控制器';找不到
当我尝试启动相册应用程序时,出现一条错误消息: 致命错误:在中找不到类“Album\Controller\AlbumController” C:\xampp\htdocs\zendskletonapplication\vendor\zendframework\zendframework\library\Zend\ServiceManager\AbstractPluginManager.php 在线170 这是我的module.config.php文件代码Zend framework2 类别';相册\控制器\相册控制器';找不到,zend-framework2,Zend Framework2,当我尝试启动相册应用程序时,出现一条错误消息: 致命错误:在中找不到类“Album\Controller\AlbumController” C:\xampp\htdocs\zendskletonapplication\vendor\zendframework\zendframework\library\Zend\ServiceManager\AbstractPluginManager.php 在线170 这是我的module.config.php文件代码 <?php return arra
<?php
return array(
'controllers' => array(
'invokables' => array(
'Album\Controller\Album' => 'Album\Controller\AlbumController',
),
),
// Added to make router
'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',
),
),
);
我知道您刚刚开始,所以我会参考Martin Shwalbe的这段代码,看看您是否有任何打字错误。如果一切看起来都很好,那么您访问它的方式可能存在问题
希望这能有所帮助……我知道您才刚刚开始,所以我会参考Martin Shwalbe的代码,看看您是否有任何打字错误。如果一切看起来都很好,那么您访问它的方式可能存在问题
希望这有助于…模块类getConfig()函数和getAutoloaderConfig()函数,以及检查所有路径模块类getConfig()函数和getAutoloaderConfig()函数,以及检查所有路径
<?php
namespace Album\Controller;
use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;
class AlbumController extends AbstractActionController {
protected $albumTable;
public function indexAction() {
return new ViewModel(array(
'album' => $this->getAlbumTable()->fetchAll(),
));
}
public function addAction() {
}
public function editAction() {
}
public function deleteAction() {
}
public function getAlbumTable () {
if (!$this->albumTable) {
$sm = $this->getServiceLocator();
$this->albumTable = $sm->get('Album\Model\AlbumTable');
}
return $this->albumTable;
}
}