0

我有一个大问题。当我使用 Zend Framework 调用我的网站时,我收到此错误:可捕获的致命错误:无法将类 Application_Model_Rawdata 的对象转换为字符串 C:\xampp** * \application\views\scripts\index\index.phtml 在线13

查看脚本第 13 行:

<p class="announcement-heading"><?php $this->rawdata; ?></p>

索引控制器

$readraw = new Application_Model_Rawdata();
$readraw->readRawData();        
$this->view->rawdata = $readraw;

班上

class Application_Model_Rawdata extends Zend_Db_Table_Abstract
{
    public function readRawData() {
        $dbTableRawdata = new Application_Model_DbTable_Rawdata();
        $rowset = $dbTableRawdata->fetchAll();
        $rowcount = count($rowset);
    }
}
4

1 回答 1

0
class Application_Model_Rawdata extends Zend_Db_Table_Abstract
{
    public function readRawData() {
        $dbTableRawdata = new Application_Model_DbTable_Rawdata();
        $rowset = $dbTableRawdata->fetchAll();
        $rowcount = count($rowset);
        return $rowcount;
    }
}

我不建议使用count()来获取记录总数。

于 2013-11-06T10:48:14.910 回答