代码之家  ›  专栏  ›  技术社区  ›  shingo

向目录发送POST请求

  •  0
  • shingo  · 技术社区  · 4 年前

    wwwroot
     └ verify
        └ index.php
    

    这里面是什么 index.php

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

    index.php

    然后我想发送一个post请求到 index.php

    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代码。

    自从 verify 是站点中的一个目录,因此我猜请求已发送到该目录,而不是重定向到默认页面。

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

    0 回复  |  直到 4 年前