发布数据不等于表单数据

时间:2013-08-31 03:01:54

标签: php

我可能会遗漏一些东西,但我无法理解发生了什么。

我的php脚本中$_POST变量中的值与表单数据中发送的值不匹配。

这是我正在做的事情。我发送两个连续的请求到相同的PHP脚本。除一个字段外,所有表单数据值在两个请求中都相同。但是在php脚本中,$_POST变量在两个请求中都具有相同的值。

以下是我在第一次向服务器发送请求时发送的原始表单数据:

  

sEcho = 1&安培; iColumns = 1&安培; sColumns =安培; iDisplayStart = 0&安培; iDisplayLength = 20&安培; mDataProp_0 = 0&安培; SSEARCH =安培; bRegex =假安培; sSearch_0 =安培; bRegex_0 =假安培; bSearchable_0 =真安培; fromSid = 1050安培; fromTable = file2.xlsx& toSid = 1049& toTable = file1.xlsx& fromTransInput = columnToMatch& toTransInput = columnToMatch& action = getDistinctFromTable & pageLength = 20

以下是我在php脚本中输入的原始输入内容:

  

sEcho = 1&安培; iColumns = 1&安培; sColumns =安培; iDisplayStart = 0&安培; iDisplayLength = 20&安培; mDataProp_0 = 0&安培; SSEARCH =安培; bRegex =假安培; sSearch_0 =安培; bRegex_0 =假安培; bSearchable_0 =真安培; fromSid = 1050安培; fromTable = file2.xlsx&安培; toSid = 1049&安培; toTable = file1.xlsx&安培; fromTransInput = columnToMatch&安培; toTransInput = columnToMatch&安培;的行动= getDistinctToTable &安培; pageLength = 20"

请注意,操作值不匹配。我在php脚本中拥有的值实际上是在第二个请求中发送的动作值。

这是表格数据的第二个请求:

  

sEcho = 1&安培; iColumns = 1&安培; sColumns =安培; iDisplayStart = 0&安培; iDisplayLength = 20&安培; mDataProp_0 = 0&安培; SSEARCH =安培; bRegex =假安培; sSearch_0 =安培; bRegex_0 =假安培; bSearchable_0 =真安培; fromSid = 1050安培; fromTable = file2.xlsx&安培; toSid = 1049&安培; toTable = file1.xlsx&安培; fromTransInput = columnToMatch&安培; toTransInput = columnToMatch&安培;的行动= getDistinctToTable &安培; pageLength = 20

以下是来自php scrip的第二个请求的原始输入内容:

  

sEcho = 1&安培; iColumns = 1&安培; sColumns =安培; iDisplayStart = 0&安培; iDisplayLength = 20&安培; mDataProp_0 = 0&安培; SSEARCH =安培; bRegex =假安培; sSearch_0 =安培; bRegex_0 =假安培; bSearchable_0 =真安培; fromSid = 1050安培; fromTable = file2.xlsx&安培; toSid = 1049&安培; toTable = file1.xlsx&安培; fromTransInput = columnToMatch&安培; toTransInput = columnToMatch&安培;的行动= getDistinctToTable &安培; pageLength = 20

任何想法是怎么回事?

更新: 这是一些代码:

在客户端我有这个:

第一次请求:

  

$。AJAX({                       url:' ../ dataMatchChecker / getDataTables.php',                       数据:[{" name":" sEcho"," value":1},{" name":" iColumns&# 34;,"值":1},{"名称":" sColumns""值":"&#34 ;},{"名称":" iDisplayStart""值":0},{"名称":" iDisplayLength&# 34;,"值" 20},{"名称":" mDataProp_0""值":0},{&#34 ;名称":" SSEARCH""值":""},{"名称":" bRegex&# 34;,"值":假},{"名称":" sSearch_0""值":"&#34 ;},{"名称":" bRegex_0""值":假},{"名称":" bSearchable_0&# 34;,"值":真},{"名称":" fromSid""值":" 1050&#34 ;},{"名称":" fromTable""值":" file2.xlsx"},{"名称&# 34;:" toSid""值":" 1049"},{"名称":" toTable&#34 ;, "值":" file1.xlsx"},{"名称":" fromTransInput""值":& #34; columnTo匹配"},{"名称":" toTransInput""值":" columnToMatch"},{"名称& #34;:"动作""值":"的 getDistinctFromTable "},{"名称&#34 ;: " pageLength""值" 20}],                       输入:' post',                       dataType:' json',                       成功:function(json){                          //在这做一些工作                       }                   });

对于第二个请求:

  

$。AJAX({                       url:' ../ dataMatchChecker / getDataTables.php',                       数据:[{" name":" sEcho"," value":1},{" name":" iColumns&# 34;,"值":1},{"名称":" sColumns""值":"&#34 ;},{"名称":" iDisplayStart""值":0},{"名称":" iDisplayLength&# 34;,"值" 20},{"名称":" mDataProp_0""值":0},{&#34 ;名称":" SSEARCH""值":""},{"名称":" bRegex&# 34;,"值":假},{"名称":" sSearch_0""值":"&#34 ;},{"名称":" bRegex_0""值":假},{"名称":" bSearchable_0&# 34;,"值":真},{"名称":" fromSid""值":" 1050&#34 ;},{"名称":" fromTable""值":" file2.xlsx"},{"名称&# 34;:" toSid""值":" 1049"},{"名称":" toTable&#34 ;, "值":" file1.xlsx"},{"名称":" fromTransInput""值":& #34; columnTo匹配"},{"名称":" toTransInput""值":" columnToMatch"},{"名称& #34;:"动作""值":"的 getDistinctToTable "},{"名称&#34 ;: " pageLength""值" 20}],                       输入:' post',                       dataType:' json',                       成功:function(json){                          //在这做一些工作                       }                   });

现在在我的服务器上我只是var_dump $_POST变量(我也是var_dump上面提到的原始内容):

  

的var_dump($ _ POST);

     

$ postdata = file_get_contents(" php:// input");

     

的var_dump($ POSTDATA);

0 个答案:

没有答案