久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

什么導致 HTTP 405“無效方法(HTTP 動詞)"?在 I

What causes an HTTP 405 quot;invalid method (HTTP verb)quot; error when POSTing a form to PHP on IIS?(什么導致 HTTP 405“無效方法(HTTP 動詞)?在 IIS 上將表單發布到 PHP 時出錯?)
本文介紹了什么導致 HTTP 405“無效方法(HTTP 動詞)"?在 IIS 上將表單發布到 PHP 時出錯?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我在 PHP (5.2.9-1) 應用程序中有一個表單,導致 IIS (Microsoft-IIS/6.0) 在發布時拋出以下錯誤:

I have one form in a PHP (5.2.9-1) application that causes IIS (Microsoft-IIS/6.0) to throw the following error when POSTed:

無法顯示您要查找的頁面,因為嘗試訪問時使用了無效方法(HTTP 動詞).

The page you are looking for cannot be displayed because an invalid method (HTTP verb) was used to attempt access.

這是一個 HTTP 405 狀態代碼.應用程序中的所有其他表單都可以工作,因此我相信 PHP 頁面的 IIS 'verbs' 設置是正確的.

It's an HTTP 405 status code. All other forms in the application work, so I believe that the IIS 'verbs' setting for PHP pages is correct.

這是客戶的服務器,我無法訪問它來驗證設置或測試代碼.我所能做的就是發送客戶更換文件.IIS 服務器上的其他客戶沒有這樣的問題.

This is a customer's server, which I have no access to for verifying settings or testing code. All I can do is send the customer replacement files. Other customers on IIS servers have no such issue.

表格非常簡單:

<form method="post" action="index.php">
    ... fields ... 
</form>

什么會導致 IIS 僅在一種形式上拋出該錯誤,而在其他形式上卻能正常工作?

What can cause IIS to throw that error on one form only, but work fine on others?

推薦答案

我設法通過 FTP 訪問客戶的服務器,因此能夠找到問題所在.

I managed to get FTP access to the customer's server and so was able to track down the problem.

提交表單后,我對用戶進行身份驗證,然后重定向到應用程序的主要部分.

After the form is POSTed, I authenticate the user and then redirect to the main part of the app.

Util::redirect('/apps/content');

錯誤不是發生在表單的發布上,而是發生在緊隨其后的重定向上.出于某種原因,IIS 繼續假定重定向的 POST 方法,然后反對 POST 到 /apps/content 因為它是一個目錄.

The error was occurring not on the posting of the form, but on the redirect immediately following it. For some reason, IIS was continuing to presume the POST method for the redirect, and then objecting to the POST to /apps/content as it's a directory.

錯誤消息從未表明是下一頁產生了錯誤 - 感謝 Microsoft!

The error message never indicated that it was the following page that was generating the error - thanks Microsoft!

解決方案是添加一個尾部斜杠:

The solution was to add a trailing slash:

Util::redirect('/apps/content/');

然后 IIS 可以將重定向解析為默認文檔,因為不再嘗試 POST 到目錄.

IIS could then resolve the redirect to a default document as is no longer attempting to POST to a directory.

這篇關于什么導致 HTTP 405“無效方法(HTTP 動詞)"?在 IIS 上將表單發布到 PHP 時出錯?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Joining 2 tables in SELECT(MYSQL/PHP)(在 SELECT(MYSQL/PHP) 中加入 2 個表)
How to make lt;option selected=quot;selectedquot;gt; set by MySQL and PHP?(如何使lt;option selected=“selectedgt;由 MySQL 和 PHP 設置?)
Auto populate a select box using an array in PHP(使用 PHP 中的數組自動填充選擇框)
PHP SQL SELECT where like search item with multiple words(PHP SQL SELECT where like search item with multiple words)
json_encode produce JSON_ERROR_UTF8 from MSSQL-SELECT(json_encode 從 MSSQL-SELECT 產生 JSON_ERROR_UTF8)
MySQL ORDER BY rand(), name ASC(MySQL ORDER BY rand(),名稱 ASC)
主站蜘蛛池模板: 久久久久久国模大尺度人体 | 在线午夜 | 亚洲欧洲一区二区 | 午夜视频在线免费观看 | 精品亚洲一区二区三区四区五区 | 日韩av免费在线观看 | 美女久久 | 免费激情 | 欧美日韩精品一区二区天天拍 | 亚洲久久一区 | 国产综合在线视频 | 久久久久久久久久一区二区 | 成人在线不卡 | 国产精品免费观看 | 一级毛片免费完整视频 | 玖玖视频| 欧美久久国产精品 | 中文字幕日本一区二区 | 成人3d动漫一区二区三区91 | 精品国产一区二区三区观看不卡 | 四虎影院欧美 | 亚洲国产中文字幕 | 国产www. | 色精品| 久久久久久久一区二区 | 亚洲国产成人精品久久久国产成人一区 | 99精品视频在线 | 欧美自拍第一页 | 91精品一区二区三区久久久久 | 祝你幸福电影在线观看 | 日韩在线精品 | 久草视| 亚洲天堂中文字幕 | 亚洲三级视频 | 日本污视频| 欧美日批 | 黄色国产区 | 亚洲美女一区二区三区 | 成人中文字幕在线 | 99久久99久久精品国产片果冰 | 欧美高清性xxxxhd |