2011-03-24 4 views
0
Fatal error: Class 'Products\Summary\Html\Section' not found 

다음 코드에서 위의 오류가 발생합니다. Summary \ Html \ Section()이 실제로 액세스하려는 클래스의 네임 스페이스인지 확인했습니다. 왜 이것이 작동하지 않는지 전혀 모르겠다 ... 어떤 생각?치명적인 오류 : 'Products Summary Html Section'클래스를 찾을 수 없습니다.

<?php 

namespace Products; 

use Products\Base as ProductBase; 
use Products\Mapping as MappingInterface; 
use Summary\Html; 

class Product1 extends ProductBase implements MappingInterface { 
    /** 
    * Complete PDF mapping 
    * 
    * @return Array 
    */ 
    public function render() { 
     $preTable = new Summary\Html\Section(); 
     $row = $preTable->addRow(); 

     $row->addColumn()->setValue('Headline one')->addClass('first'); 
     $row->addColumn()->setValue('Headline two')->addClass('first'); 

     return $preTable; 
    } 

내 섹션 클래스 :이 요약은 생각처럼

namespace Summary\Html; 

use Summary\Html\Element; 


use Summary\Html\Section\Row; 

class Section extends Element { 
+0

클래스는 명시 적으로 포함 중이거나, 오른쪽 __autoload 기능을 탑재? 확실한 질문에 대해 유감스럽게 생각하지만, 이런 종류의 것들은, 특히 오작동하는 __autoload 인 경우 그리워하기 쉽습니다. 클래스 파일의 상단에 에코 ('something')를 넣는 것이 좋습니다. – GordonM

답변

2

이 보이는 \ html로는 제품 네임 스페이스의 일부입니다. 이 시도 :

$preTable = new \Summary\Html\Section();

+0

그 덕분에, 고마워! – Webnet

+0

오, 그리고 지적하기 바란다 :'Use Summary \ Html;'을 선언 할 때'use Summary \ Html as Html; '과 동일하므로'$ preTable = new Html \ Section() ; '자세한 내용은 여기를 참조하십시오 : http://www.php.net/manual/en/language.namespaces.importing.php –

관련 문제