久久久久久久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网站 | 青青99| 91久久精品一区二区二区 | 久久伊人精品 | 亚洲电影在线播放 | 久久久久久网站 | 国产在线一区二区 | 337p日本欧洲亚洲大胆 | av高清毛片 | 国产清纯白嫩初高生在线播放视频 | 成人精品国产免费网站 | 成人在线观看免费 | 99精品免费久久久久久日本 | 亚洲国产精品久久久久 | 成人污污视频 | 成人在线视频观看 | 一区二区三区在线免费观看 | 国产一区二区三区在线 | 天天爽一爽 | 久久成人亚洲 | 亚洲精品4 | 九九色九九 | 国产精品久久久久久久久久久久久 | 久久国产免费看 | 在线一区二区三区 | 91久久精品一区 | 一区二区在线免费观看 | 久久免费精品 | 亚洲美乳中文字幕 |