发送POST请求到目录

时间:2020-09-12 07:45:09

标签: apache nginx post iis iis-7.5

这是网站结构:

wwwroot
 └ verify
    └ index.php

这是index.php

中的内容
<?php
echo $_SERVER['REQUEST_METHOD'], PHP_EOL;
echo file_get_contents('php://input');

我试图在IIS,nginx和httpd上运行此站点。 index.php已配置为默认页面的第一位

然后我想向index.php发送发帖请求,我尝试了3种方法:

1. <form action="http://localhost/verify" method="POST">
2. <form action="http://localhost/verify/" method="POST">
3. <form action="http://localhost/verify/index.php" method="POST">

第二种方法和第三种方法没有问题,但是第一种方法(没有尾斜杠)没有问题:

  • 在IIS中,我得到405.0代码。

  • 在nginx和httpd中,请求方法变为“ GET”,并且帖子数据丢失。

由于verify是站点中的目录,因此我想请求已发送到该目录,而不是重定向到默认页面。

如何配置这些服务器(或其中一台)以接受发送到目录url的发布请求?

0 个答案:

没有答案