致命错误:找不到类'Products \ Summary \ Html \ Section'

时间:2011-03-24 15:37:35

标签: php

Fatal error: Class 'Products\Summary\Html\Section' not found

我在以下代码中遇到上述错误。我已经验证了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 {

1 个答案:

答案 0 :(得分:2)

看起来它认为Summary \ Html是Products命名空间的一部分。试试这个:

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