【问题标题】:$_POST data does not work with ../ 1 up folder action$_POST 数据不适用于 ../ 1 up 文件夹操作
【发布时间】: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 DIR Web 根目录还是只是应用程序的根文件夹?
  • 网络根目录是(ROOT DIR)

标签: php html post directory


【解决方案1】:

你的做法

<form id="test" action="../includes/action.php"  method="POST" >

表示“yoursite.com/../includes/action.php”,它不起作用。

尝试做:

<form id="test" action="/includes/action.php"  method="POST" >

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-03-14
    • 1970-01-01
    • 2021-01-27
    • 2012-10-20
    • 1970-01-01
    • 1970-01-01
    • 2014-01-25
    • 1970-01-01
    相关资源
    最近更新 更多