在 XAMPP 中的服务器上找不到请求的 URL

Requested URL not found on the server in XAMPP

当我遇到这个问题时,我正在 XAMPP 工作。 我的代码旨在通过表单从用户那里获取一些信息作为输入。 然后在按下 "SUBMIT" 按钮后在同一页面中显示输出。 (我在代码的 HTML 部分使用了 " method="POST">...)

Object not found!

The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error. If you think this is a server error, please contact the webmaster.

Error 404 localhost Apache/2.4.33 (Win32) OpenSSL/1.1.0g PHP/7.2.4

提前致谢

问题是您将表单发送到一个不存在的页面。确保在表单的 action 属性中使用 $_SERVER['PHP_SELF'] 。 示例:

<form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>">