我正在使用Zend Framework,版本1.11,我遇到了以下问题:
提交表单后,浏览器产生“未收到数据:无法加载网页,因为服务器已发送没有数据。” (在Chrome上)和“在加载页面时重置与服务器的连接。”在Firefox上。
现在,可能与我的机器有关,因为我不能在其他具有类似配置的机器上重现错误,除了服务器版本(我已升级到apache 2.4.7,其他机器有apache 2.2)。
现在请求通过持续的代码是:$此的Zend Framework - 没有收到数据
$form = new Website_Form_ArtUpload();
if ($this->getRequest()->isPost())
{
$response = $this->_getService()->upload($this->getRequest()->getPost());
My_Logger::log(print_r($response));
if (!$response->isValid()) {
if($response->getData() instanceof Zend_Form) {
$form = $response->getData();
}
if($response->hasMessages()) {
My_Logger::log(print_r($response->getAllMessages()));
$this->view->messages = $response->getAllMessages();
}
} else {
$this->_helper->redirector->gotoSimple('new', 'product', 'website');
return;
}
}
内容 - > _的getService() - >上传()
// Validate the form
$form = new Website_Form_ArtUpload();
if (!$form->isValid($data))
return new My_Service_Response(
My_Service_Response::FAILURE,
$form,
array(My_Model_Message::MESSAGE_TYPE_ERROR => $this->getTranslator()->_('The product cannot be uploaded'))
); //here it halts
所以,这一次,我没有想法为什么数据不应该有效,因为一切似乎都可以。但假设数据确实无效,因为响应失败并且有消息($this->view->messages = $response->getAllMessages()
记录了消息),所以我不明白为什么不会有一个错误说'产品无法上传'。
如果您需要任何其他代码或任何日志,我很乐意提供它们。
注意:有错误的其他表单会正确返回消息。 请不要告诉我,我们应该有相同的服务器版本,但我知道,但是如果将来我们想要迁移到2.4版本,我们宁愿已经解决了。