html post form action 没有具体拼出 php 文件吗?

发布于 2024-08-09 18:04:55 字数 224 浏览 13 评论 0原文

我有一个 post html 表单,操作是index.php,这是网站的主页。我的地址栏中实际上从来没有index.php,因为指向“/”的链接会指向它,即使我这样做了,它也会是website.com/home(/),因为我使用重写规则。所以基本上,用户永远不应该看到index.php。然而,如果操作不是特定的index.php,则表单提交不起作用,“/”不起作用,即使它解析为index.php。关于如何解决这个问题有什么想法吗?

I have a post html form, and the action is index.php, which is the websites main page. I never actually have index.php in the address bar, since links to "/" go to it, and even if I did, it would be website.com/home(/), since I use rewrite rules. So basically, the user should never see index.php. However, the form submit doesn't work if the action isn't spefically index.php, "/" doesn't work, even though that resolves to index.php. Any ideas on how to get around this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

微凉徒眸意 2024-08-16 18:04:55

不要指定操作。如果帖子发布到他们所在的页面,则表单的默认操作是发布到该页面。

Don't specify the action. If the post is to the page they're on, the default action of the form is to post to that.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文