0

我是 Zend 的新手,并尽我最大的努力学习和使用 Zend framework2、Dojo 和 Zend Json 服务器构建一个 Web 应用程序。我使用 dojo 组件编写了一个 html 页面。我的页面首先完全下载(此时没有 json 调用)。我添加了一个 onBlur 函数,该函数调用 Json 服务器进行响应并解析响应以加载国家/地区过滤器选择框。Dojo filterselect 使用 json rpc 客户端调用服务器并返回数据。如果我的数据(数据库中的记录)最多有 60 条记录,那么它可以正常工作。但是,如果该列表超过 60 条记录(可能是 200 多条记录),zend 服务器会转储一个异常(作为响应,它包含 json 数据 + 解析失败的异常)“警告:无法修改标头信息 - 标头已由(输出开始在 ”

Json server details
    public function populatelistAction() {
    $class = "MO\Model\MOGuest";
    $server = new Server();
    $server->setClass($class);
    if ('GET' == $_SERVER['REQUEST_METHOD']) {
    $server->setTarget('populatelist')->setEnvelope(Smd::ENV_JSONRPC_2);
    $smd = $server->getServiceMap();
    // Set Dojo compatibility:
    $smd->setDojoCompatible(true);
    header('Content-Type: application/json');
    echo $smd;
    return $this->getResponse();
    } else {
    //$server->handle(); 
    }
    $server->handle();
    return $this->getResponse();
}

请在这个问题上指导我,因为我一无所知,因为它可以工作到 60 记录并且失败更多。下面是我得到的例外。这是一个错误还是我错过的任何事情。我验证它与 Dojo 无关,因为直接调用服务(使用 Restclient firefox 插件)也失败了。

{"id":"208","catcode":"SR"},{"id":"209","catcode":"SJ"},{"id":"210","catcode":"SZ"},{"id":"211","catcode":"SE"},{"id":"212","catcode":"CH"},{"id":"213","catcode":"SY"},{"id":"214","catcode":"TW"},{"id":"215","catcode":"TJ"},{"id":"216","catcode":"TZ"},{"id":"217","catcode":"TH"},{"id":"218","catcode":"TL"},{"id":"219","catcode":"TG"},{"id":"220","catcode":"TK"},{"id":"221","catcode":"TO"},{"id":"222","catcode":"TT"},{"id":"223","catcode":"TN"},{"id":"224","catcode":"TR"},{"id":"225","catcode":"TM"},{"id":"226","catcode":"TC"},{"id":"227","catcode":"TV"},{"id":"228","catcode":"UG"},{"id":"229","catcode":"UA"},{"id":"230","catcode":"AE"},{"id":"231","catcode":"US"},{"id":"232","catcode":"UM"},{"id":"233","catcode":"UY"},{"id":"234","catcode":"UZ"},{"id":"235","catcode":"VU"},{"id":"236","catcode":"VE"},{"id":"237","catcode":"VN"},{"id":"238","catcode":"VG"},{"id":"239","catcode":"VI"},{"id":"240","catcode":"GB"},{"id":"241","catcode":"WF"},{"id":"242","catcode":"EH"},{"id":"243","catcode":"YE"},{"id":"244","catcode":"ZM"},{"id":"245","catcode":"ZW"}]],"id":"1"}<br />
<font size='1'><table class='xdebug-error' dir='ltr' border='1' cellspacing='0' cellpadding='1'>
<tr><th align='left' bgcolor='#f57900' colspan="5"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>( ! )</span> Warning: Cannot modify header information - headers already sent by (output started at C:\Users\amsh\Documents\NetBeansProjects\myoffice\vendor\zendframework\zendframework\library\Zend\Json\Server\Server.php:182) in C:\Users\amsh\Documents\NetBeansProjects\myoffice\vendor\zendframework\zendframework\library\Zend\Http\PhpEnvironment\Response.php on line <i>62</i></th></tr>
<tr><th align='left' bgcolor='#e9b96e' colspan='5'>Call Stack</th></tr>
<tr><th align='center' bgcolor='#eeeeec'>#</th><th align='left' bgcolor='#eeeeec'>Time</th><th align='left' bgcolor='#eeeeec'>Memory</th><th align='left' bgcolor='#eeeeec'>Function</th><th align='left' bgcolor='#eeeeec'>Location</th></tr>
<tr><td bgcolor='#eeeeec' align='center'>1</td><td bgcolor='#eeeeec' align='center'>0.0236</td><td bgcolor='#eeeeec' align='right'>644056</td><td bgcolor='#eeeeec'>{main}( )</td><td title='C:\Users\amsh\Documents\NetBeansProjects\myoffice\public\index.php' bgcolor='#eeeeec'>..\index.php<b>:</b>0</td></tr>
<tr><td bgcolor='#eeeeec' align='center'>2</td><td bgcolor='#eeeeec' align='center'>0.7178</td><td bgcolor='#eeeeec' align='right'>9273664</td><td bgcolor='#eeeeec'>Zend\Mvc\Application->run( )</td><td title='C:\Users\amsh\Documents\NetBeansProjects\myoffice\public\index.php' bgcolor='#eeeeec'>..\index.php<b>:</b>12</td></tr>
<tr><td bgcolor='#eeeeec' align='center'>3</td><td bgcolor='#eeeeec' align='center'>1.8114</td><td bgcolor='#eeeeec' align='right'>11844912</td><td bgcolor='#eeeeec'>Zend\EventManager\EventManager->trigger( )</td><td title='C:\Users\amsh\Documents\NetBeansProjects\myoffice\vendor\zendframework\zendframework\library\Zend\Mvc\Application.php' bgcolor='#eeeeec'>..\Application.php<b>:</b>303</td></tr>
<tr><td bgcolor='#eeeeec' align='center'>4</td><td bgcolor='#eeeeec' align='center'>1.8114</td><td bgcolor='#eeeeec' align='right'>11845120</td><td bgcolor='#eeeeec'>Zend\EventManager\EventManager->triggerListeners( )</td><td title='C:\Users\amsh\Documents\NetBeansProjects\myoffice\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php' bgcolor='#eeeeec'>..\EventManager.php<b>:</b>208</td></tr>
<tr><td bgcolor='#eeeeec' align='center'>5</td><td bgcolor='#eeeeec' align='center'>1.8138</td><td bgcolor='#eeeeec' align='right'>11847840</td><td bgcolor='#eeeeec'><a href='http://www_php_net/call_user_func' target='_new'>call_user_func</a>
( )</td><td title='C:\Users\amsh\Documents\NetBeansProjects\myoffice\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php' bgcolor='#eeeeec'>..\EventManager.php<b>:</b>468</td></tr>
<tr><td bgcolor='#eeeeec' align='center'>6</td><td bgcolor='#eeeeec' align='center'>1.8138</td><td bgcolor='#eeeeec' align='right'>11847872</td><td bgcolor='#eeeeec'>Zend\Mvc\View\SendResponseListener->sendResponse( )</td><td title='C:\Users\amsh\Documents\NetBeansProjects\myoffice\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php' bgcolor='#eeeeec'>..\EventManager.php<b>:</b>468</td></tr>
<tr><td bgcolor='#eeeeec' align='center'>7</td><td bgcolor='#eeeeec' align='center'>1.8139</td><td bgcolor='#eeeeec' align='right'>11847872</td><td bgcolor='#eeeeec'>Zend\Http\PhpEnvironment\Response->send( )</td><td title='C:\Users\amsh\Documents\NetBeansProjects\myoffice\vendor\zendframework\zendframework\library\Zend\Mvc\View\SendResponseListener.php' bgcolor='#eeeeec'>..\SendResponseListener.php<b>:</b>71</td></tr>
<tr><td bgcolor='#eeeeec' align='center'>8</td><td bgcolor='#eeeeec' align='center'>1.8139</td><td bgcolor='#eeeeec' align='right'>11847872</td><td bgcolor='#eeeeec'>Zend\Http\PhpEnvironment\Response->sendHeaders( )</td><td title='C:\Users\amsh\Documents\NetBeansProjects\myoffice\vendor\zendframework\zendframework\library\Zend\Http\PhpEnvironment\Response.php' bgcolor='#eeeeec'>..\Response.php<b>:</b>100</td></tr>
<tr><td bgcolor='#eeeeec' align='center'>9</td><td bgcolor='#eeeeec' align='center'>1.8142</td><td bgcolor='#eeeeec' align='right'>11848000</td><td bgcolor='#eeeeec'><a href='http://www/php/net/header' target='_new'>header</a>
( )</td><td title='C:\Users\amsh\Documents\NetBeansProjects\myoffice\vendor\zendframework\zendframework\library\Zend\Http\PhpEnvironment\Response.php' bgcolor='#eeeeec'>..\Response.php<b>:</b>62</td></tr>
</table></font>"
4

1 回答 1

0

我坚信这是一个缺陷,我为此创建了一个修复程序。只有 Zend 团队会确认问题并进行修复。可悲的是,到目前为止,还没有人调查过这个问题。

更多详细信息在下面的链接中:如果您打算使用此修复程序,那么您必须确保修复程序是正确的,因为我不是保证修复程序的合适人选。对于那个联系 Zend 框架团队。由于这是我的修复,我只是 Zend 的初学者,所以修复必须得到 Zend 团队的认证或提供更好的解决方案。 https://github.com/zendframework/zf2/issues/3225

于 2012-12-18T08:08:14.860 回答