2016-03-08 143 views
0

致命錯誤:類「相冊\相冊」,在/var/www/html/zf2/module/Album/Module.php未找到在線43上Zend框架致命錯誤

此錯誤顯示每當我試圖TI訪問本地主機/專輯

我module.php

<?php 
namespace Album; 
use Zend\Db\ResultSet\ResultSet; 
use Zend\Db\TableGateway\TableGateway; 
use Zend\ModuleManager\Feature\AutoloaderProviderInterface; 
use Zend\ModuleManager\Feature\ConfigProviderInterface; 
use Album\Model\AlbumTable; 
class Module implements AutoloaderProviderInterface,ConfigProviderInterface{ 
public function getAutoloaderConfig() 
{ 
    return array(
     'Zend\Loader\ClassMapAutoloader' => array(
      __DIR__ . '/autoload_classmap.php', 
     ), 
     'Zend\Loader\StandardAutoloader' => array(
      'namespaces' => array(
       __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__, 
      ), 
     ), 
    ); 
} 

public function getConfig() 
{ 
    return include __DIR__ . '/config/module.config.php'; 
} 

    public function getServiceConfig() 
{ 
    return array(
     'factories' => array(
      'Album\Model\AlbumTable' => function($sm) { 
       $tableGateway = $sm->get('AlbumTableGateway'); 
       $table = new AlbumTable($tableGateway); 
       return $table; 
      }, 
      'AlbumTableGateway' => function ($sm) { 
       $dbAdapter = $sm->get('Zend\Db\Adapter\Adapter'); 
       $resultSetPrototype = new ResultSet(); 
      $resultSetPrototype->setArrayObjectPrototype(new Album()); 
       return new TableGateway('album', $dbAdapter, null, $resultSetPrototype); 
      }, 
     ), 
    ); 
}}?> 

如何解決這個問題? 請給我解決方案,zend看起來如此強硬我試圖從2周bt學習zend這個錯誤只是吃了我的腦海。 請幫助guyz

+0

Album類是否存在?它定義了哪個文件? –

回答

0

請確保您的名稱空間設置正確。如果您像您一樣調用Album,則您的Album類必須位於Album名稱空間中。否則使用完全限定名稱。

+0

錯誤仍然存​​在,錯誤發生在第43行 $ resultSetPrototype-> setArrayObjectPrototype(new Album()); –

+0

您的Album類別在哪裏?它在Album \ Album中嗎?這很可能是一個命名空間問題... –