邮递员返回原始表单,而不是表单操作链接文档

时间:2018-10-24 16:33:28

标签: php html postman

我正在和Postman一起测试HTML表单。为此,我在本地Web服务器上放置了以下三个代码段。

该表单在服务器上工作正常,但是当我通过Postman调用getpost时,Postman只返回index.html而不是PHP响应(请参见下图)。知道为什么会这样以及如何解决吗?

1)index.html

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body>
<form action="get.php" method="get">
  First name: <input type="text" name="fname"><br>
  Last name: <input type="text" name="lname"><br>
  <input type="submit" value="Submit Get">
</form> 
<form action="post.php" method="post">
  First name: <input type="text" name="fname"><br>
  Last name: <input type="text" name="lname"><br>
  <input type="submit" value="Submit Post">
</form> 
</body>
</html>

2)get.php

<?php    
echo "<p>".$_GET["fname"]."</p>";
echo "<p>".$_GET["lname"]."</p>";
?>

3)post.php

<?php 
echo "<p>".$_POST["fname"]."</p>";
echo "<p>".$_POST["lname"]."</p>";
?>

顺便说一句,直接从Postman内部使用表格也是行不通的,但是我认为那不是必须的。我使用的是最新版本的邮递员,结果相同。

enter image description here

0 个答案:

没有答案
相关问题