Php 使用Zend fetchOne返回值时出错

Php 使用Zend fetchOne返回值时出错,php,mysql,zend-framework,zend-db,Php,Mysql,Zend Framework,Zend Db,我想返回这样的活动用户数 $objSelect = $this->select() ->from("user", "COUNT(*) AS count" ) ->where( "status = ?", 'Active' ); $return = $this->fetchOne($objSelect); echo $return; 但这会返回错误:调用未定义的方法User\u Mo

我想返回这样的活动用户数

    $objSelect = $this->select()
                ->from("user", "COUNT(*) AS count" ) 
                ->where( "status = ?", 'Active' );
    $return = $this->fetchOne($objSelect);
    echo $return;
但这会返回错误:调用未定义的方法User\u Model\u User::fetchOne()


我这里缺少什么?

fetchOne
用于DB适配器,而不是表网关对象。您正在混合两个不同的DB抽象类。请尝试
$return=$this->current()错误未定义方法current()对不起,
$return=$objSelect->current()@Anthony;不,这让我的行为很奇怪。当我更改为$return=$this->fetchRow($objSelect)时;和echo$return->toArray()我得到了数组“count”=>的预期值。所以我很好奇,为什么fetchOne在我只想得到值的情况下却不能按预期工作。