2011-03-04 88 views
2

我有以下控制文件:POST變量空

<?php 
class Test extends CI_Controller 
{ 
    function __construct() 
    { 
     parent::__construct(); 
    } 

    function index() 
    { 
     print_r($_POST); 
     $view_params = array(); 

     $this->load->view('test', $view_params); 
    } 
} 
?> 

用的視圖文件:

<form action="/test" method="post"> 
    <input type="text" name="test" /> 
    <input type="submit" /> 
</form> 

<ul id="account"> 
    <li class="separator url"><label>Domain Address (URL)</label><input maxlength="22" type="text" name="sub_url" /> 
    <small class="subtext">This is the link people use to find your site. You can change this at any time.</small> 
</li> 
</ul> 
<img class="green_arrow" src="assets/images/green_arrow.png" /> 

當我點擊提交按鈕,無後數據被吐了出來,但是當我做了頁面刷新,它說數據已發佈並將重新發送。

此外,我認爲HTML只是一個片段,但請理解我試圖減少代碼,因此減少了問題領域的數量。之後垃圾太多的原因是因爲如果我刪除了視圖文件停止工作,但這是另一個問題。

+0

如果你只是調用父類的構造函數,那麼你不需要你的構造函數 - 這已經爲你完成了。 – 2011-03-05 00:11:48

+0

它打印的是什麼?陣列()?或者什麼也沒有? – 2011-03-05 00:15:47

+0

打印Array()。 – JohnathanKong 2011-03-05 00:21:40

回答

1

嘿喬納森,我很高興我得到了解決您的問題。你所要做的就是啓用Apache的mod重寫。

a2enmod rewrite 
/etc/init.d/apache2 reload 

因爲你沒有Apache的國防部重寫,代碼點火器一定是搞砸了一些重寫規則和後搞砸了你的表單數據回。