在IIS7/PHP/Laravel上进行PUT和DELETE [英] PUT and DELETE on IIS7/PHP/Laravel

查看:75
本文介绍了在IIS7/PHP/Laravel上进行PUT和DELETE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法在IIS7上对基于Laravel的API进行PUT和DELETE请求.

I'm having trouble making PUT and DELETE requests to my Laravel-powered API work on IIS7.

回答其他问题的答案是,允许将PUT和DELETE动词映射到ExtensionlessUrlHandler处理程序.这对我不起作用,可能是因为API是PHP,并且该处理程序不会将请求发送到PHP?

Answers to other questions have said to allow the PUT and DELETE verbs to be mapped to the ExtensionlessUrlHandler handler. This doesn't work for me, possibly because the API is PHP, and that handler doesn't send the request to PHP?

我通过添加一个新的处理程序使其工作,将*映射到FastCgiHandler(与.php相同).这使得对API的PUT和DELETE请求可以工作,但是这意味着服务器正在使用php-cgi.exe来提供静态内容,这意味着我的样式表无法正确传递.

I've made it work by adding a new handler, mapping * to FastCgiHandler (the same as .php is mapped to). This makes PUT and DELETE requests to the API work, but means that the server is using php-cgi.exe to serve static content, meaning my stylesheets aren't coming through correctly.

我无法将处理程序映射 just 添加到/api文件夹中,因为路由是通过Laravel处理的,所以不是一个/api文件夹来放置将web.config文件导入.

I can't add the handler mapping just to the /api folder, because routing is handled via Laravel so there isn't an /api folder to put the web.config file into.

请求过滤设置为允许所有动词(甚至是未列出的动词),并且我没有安装WebDAV(其他两个常见的解决方案).

Request filtering is set to allow all verbs (even unlisted ones), and I don't have WebDAV installed (two other common solutions).

可能是因为我最初设置的处理程序情况不正确?我不确定-我不是IIS方面的专家.

It may be that I have the handler situation set up incorrectly to begin with? I'm not sure- I'm no expert on IIS.

任何见解将不胜感激.

推荐答案

转到 处理程序映射> PHPXX_via_FastCGI>编辑(右键单击)>请求限制>动词 并选择所有动词"(或在列表中添加PUT和DELETE)

Go to Handler Mappings > PHPXX_via_FastCGI > Edit (right click) > Request Restrictions > Verbs and select "All Verbs" (or add PUT and DELETE to the list)

其中XX是您使用的版本(例如,我使用PHP 5.4,因此它是54).

where XX is the version you're using (for example I use PHP 5.4 so it's 54).

这篇关于在IIS7/PHP/Laravel上进行PUT和DELETE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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