Home  >  Article  >  Backend Development  >  mysql - 在框架内php调用某个方法, nginx 报 405错误 Status Code:405 Method Not Allowed

mysql - 在框架内php调用某个方法, nginx 报 405错误 Status Code:405 Method Not Allowed

WBOY
WBOYOriginal
2016-06-06 20:36:201332browse

在框架内方法某个方法 nginx 报 405错误 Status Code:405 Method Not Allowed

Remote Address:102.224.214.168:80
Request URL:http://test.miyabaobei.com/index.php/wap/paycenter-perpare_by_weixin.h...
Request Method:GET
Status Code:405 Method Not Allowed

回复内容:

在框架内方法某个方法 nginx 报 405错误 Status Code:405 Method Not Allowed

Remote Address:102.224.214.168:80
Request URL:http://test.miyabaobei.com/index.php/wap/paycenter-perpare_by_weixin.h...
Request Method:GET
Status Code:405 Method Not Allowed

通常出现405错误是请求的method和你的配置不符,举个例子:

<code>javascript</code><code>app.post('/some/thing', function() {});
</code>

如果我通过浏览器访问 /some/thing 肯定抛405异常,因为定义的路由仅支持POST方法。

看看路由啊什么的 什么框架啊。

很简单,你应该是用了backbone,或者类似 的前端框架。这种框架默认你的server是RESTful的,405,是你发起的请求不是post,是Put,你可以抓包看一下。如果你用的是backbone,可以回复我,我最近才解决的这个问题。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn