【发布时间】:2015-07-07 01:55:43
【问题描述】:
当我将 action.php 文件直接放在与我的主机上的 index.php 相同的位置时,当我将 php 文件上移 1 个文件夹并进入包含文件夹时,我的表单 $_POST 数据工作得非常好,如下所示:
<!-- This works perfectly fine -->
<form id="test" action="action.php" method="POST" >
<!-- This does NOT pass the $_POST data but it goes to the php file and outputs the print test I put in the action.php file. so it is going where it needs to go but it is losing the POST data for some weird reason -->
<form id="test" action="../includes/action.php" method="POST" >
有效的文件夹结构
(ROOT DIR)Test form
-js
-img
-index.php
-action.php
不起作用的文件夹结构
(ROOT DIR) includes
- action.php
(ROOT DIR) Test form
-js
-img
-index.php
即使将包含文件夹权限设置为 chmod 777,也没有运气。直接把文件放回去,数据打印结果就好了。
为什么会发生这种情况?除了表单动作没有任何变化。一旦我这样做了,当我尝试测试它时,所有数据都会丢失。
真的很奇怪。
【问题讨论】:
-
是
ROOT DIRWeb 根目录还是只是应用程序的根文件夹? -
网络根目录是(ROOT DIR)