我在Ubuntu(17.10)LAMP安装(php 7.1)上遇到了麻烦。我假设它配置错误但无法在文档中找到或谷歌如何解决它。发布请求可以正常工作到同一页面,但是将请求发布到另一个页面不起作用。请注意,这两个页面都在同一台服务器上。
引用以下文件,如果我输入数据(123和ABC)并单击"提交本地",我得到:
如果我输入数据(567和AAA)并单击"提交远程",我得到:
testPost.php:
echo "testPost.php<BR/>\n" ;
foreach ($_POST as $key => $value) {
echo "<tr>";
echo "<td>";
echo $key;
echo "</td>";
echo "<td>";
echo $value;
echo "</td>";
echo "</tr>";
}
?>
</table>
<form action="" method="POST">
<input name="PostData1" type="text" />
<input name="PostData2" type="text" />
<input type="submit" name="submit self" value="Submit Local">
</form>
<form action="http://www.swsuperman.com/PostTest.php" method="POST">
<input name="PostData1" type="text" />
<input name="PostData2" type="text" />
<input type="submit" name="submit remote" value="Submit Remote">
</form>
PostTest.php:
<table>
<?php
echo "PostTest.php<BR/>\n" ;
foreach ($_POST as $key => $value) {
echo "<tr>";
echo "<td>";
echo $key;
echo "</td>";
echo "<td>";
echo $value;
echo "</td>";
echo "</tr>";
}
?>
</table>