表得到的作品,表单POST不 [英] Form GET works, Form POST does not

查看:116
本文介绍了表得到的作品,表单POST不的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的形式,行为与预期,当方法=GET,但方法=POST,事实并非如此。

I have a simple form that behaves as expected when method="GET", but when method="POST", it does not.

FORM:

<form action="/login" method="POST">
<input type="text" name="user" maxlength="30" value="">
<input type="password" name="pass" maxlength="30" value="">
<input type="hidden" name="sublogin" value="1">
<input type="submit" value="Login" /> 
</form>

如果我呼应变量屏幕(的var_dump($ _ POST)的var_dump($ _ GET))当方法=POST,我得到一个空数组。当方法=GET我得到了适当的名称/值对(user和pass,sublogin ...)

If I echo the variables to the screen (var_dump( $_POST ) or var_dump( $_GET )), when method="POST", I get an empty array. When method="GET" I get an array with the appropriate name/value pairs (user, pass, sublogin...)

事项:

  • 的.htaccess处理的文件名(行动)的.PHP,也都重定向到index.php如果文件物理上不存在。
  • 在其他形式的现场工作蛮好用POST
  • 的形式工作正常在我的本地机器
  • 萤火虫显示302使用POST时,临时移动

每个请求添加.htaccess文件:

.htaccess file added per request:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .$ index.php

任何帮助是AP preciated!

Any help is appreciated!

推荐答案

这个问题甚至没有接近我的思路。

The problem wasn't even close to my line of thought.

这集A类破坏了$ _POST阵列处理是行为不端后,但无论如何,被毁坏我的$ _POST数组。只有可能发生在PHP 5.3的机器(警告是导致该类胡作非为),服务器运行5.2。

A class that sets destroys the $_POST array after processing was misbehaving, but was destroying my $_POST array anyway. Only happens on machines with PHP 5.3 (a warning was causing the class to misbehave), server was running 5.2.

感谢您,Briedis试图帮助。对不起,我领你们在白费力气!

Thank you, Briedis for trying to help. Sorry I led you on a goose chase!

解决的办法,当然是写处理警告在类,而不是让$ _POST数组被摧毁一个更好的办法。

The solution, of course, was to write a better way of handling warnings in that class and not allowing the $_POST array to get destroyed.

这篇关于表得到的作品,表单POST不的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆