来自AngularJs中PHP的net :: ERR_EMPTY_RESPONSE [英] net::ERR_EMPTY_RESPONSE from PHP in AngularJs

查看:173
本文介绍了来自AngularJs中PHP的net :: ERR_EMPTY_RESPONSE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的PHP项目中有付款部分,其中使用AngularJs在前端显示来自API的付款响应。 CURL用于从PHP端调用付款API。从付款API获得响应后,我将相应地更新数据库。

I have payment section in my PHP project where payment response from the API is displayed in the frond-end using AngularJs. CURL is used for calling payment API from PHP end. After getting the response from payment API, I am updating the Database accordingly.

我发现的问题是,我一直没有不断获得角度方面的API响应即使所有支持的功能都正常工作。

The issue what i found is, I haven't continuously getting the API response in the angular side even-if all the backed functionalities are working properly.

我检查了许多浏览器的网络标签,但在每种故障情况下我都没有响应,但返回-end DB正在正确更新。

I have checked with many browser network tab, but in every failure case i have't got a response, but back-end DB is updating properly.

在每种成功和失败的情况下(失败的意思是,在angularjs HTTP POST请求中没有得到响应),我已经在JSON响应中记录了在这两种情况下,PHP端(将发送到有角的端作为响应)似乎都相似。

Also in every success and failure case (failure means, Not getting response in angularjs HTTP POST request ), I have logged the JSON response in the PHP side (Which is going to send to angular side as response) seems similar in both cases.

有关其他信息:
在网络选项卡的标题部分,对于错误情况,没有响应头出现。因此,由于没有响应,因此它不会触发angularjs http post的then块,而是会触发error块。
并且在控制台选项卡中,该失败的请求url显示 net :: ERR_EMPTY_RESPONSE。

For additional information: In network tab, header section, there is no response header coming, for the error case. So its not triggering the then block of angularjs http post, instead its triggering the error block, as there is no response. And in console tab its showing "net::ERR_EMPTY_RESPONSE" for that failing request url.

有人对我为什么没有得到响应有任何想法吗?角边随机吗?

Does anyone have any idea about why am i not getting response in angular side randomly ?

推荐答案

找到了答案。
通过设置 Http动词-选项解决了我的问题。此外,禁用代理服务器也会有所帮助。

Found the answer. By setting Http verbs - options solved my issue. Also disabling the proxy server helps.

这篇关于来自AngularJs中PHP的net :: ERR_EMPTY_RESPONSE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆