我有一個簡單的表單,其行爲與預期的相同method="GET"
,但是當它爲method="POST"
時,它沒有。表單GET工作,表單POST不是
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 ...)
事項:
- 的.htaccess處理文件名的.PHP (action),如果文件沒有物理存在,它也會將所有內容重定向到index.php。
- 其他形式的現場工作只是罰款POST
- 形式的作品我的本地機器
- Firebug的精細顯示302使用POST
每個請求添加.htaccess文件時,暫時移動:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .$ index.php
任何幫助表示讚賞!
你可以顯示htaccess文件嗎? – 2011-04-04 21:59:51
絕對。我已經將內容添加到問題本身。 – irms 2011-04-04 22:15:28
你的重寫規則有點奇怪。你重寫index.php的一切? 你可以試試這個:RewriteRule ^(。*)$ index.php [L,QSA] 或者,你可能拼寫錯了/login.php(如果它的意思是一個文件)? – 2011-04-04 22:20:47