久久久久久久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)
主站蜘蛛池模板: 久久大陆| 人人草人人干 | 久久久久久亚洲精品 | 99爱国产 | 日韩在线精品 | 一区二区三区日韩精品 | 亚洲日本欧美日韩高观看 | 中文字幕成人av | 久久狠狠| 天天看天天摸天天操 | 日本一区二区三区免费观看 | 国产一区在线免费 | 中文精品久久 | 欧美日韩不卡 | 日本精品一区二区三区视频 | 国产一区二区三区在线 | 91伊人 | 成人在线视频一区 | 日韩三级在线 | 午夜视频免费 | 一区二区三区免费在线观看 | 综合久久亚洲 | 91在线精品视频 | 97日日碰人人模人人澡分享吧 | 亚洲精品一区二区三区中文字幕 | 中文成人无字幕乱码精品 | 成人精品一区 | 免费国产一区 | 99精品视频在线观看 | 伊人春色在线 | 在线观看视频福利 | 免费国产视频 | 亚洲精品久 | 99福利在线观看 | 国产在线观看一区二区三区 | 在线a视频 | 99精品一区二区 | 天天噜天天干 | 国产一区免费 | 久久久久九九九女人毛片 | 干干天天 |