编辑htaccess文件后,表单提交值在codeigniter中变空

时间:2015-05-16 08:23:08

标签: php .htaccess codeigniter

我尝试了表单提交但是我无法在控制器上获取表单值。之前它对我有用。但是现在从URL中删除index.php我替换了htaccess文件。从那时起它重新调整空数据。这里是htaccess文件。我引用了这个链接not able get post form submit values in codeigniter并替换了htaccess文件,然后POST正在工作,但" index.php"在URL中没有删除。

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    #Removes access to the system folder by users.
    #Additionally this will allow you to create a System.php controller,
    #previously this would not have been possible.
    #'system' can be replaced if you have renamed your system folder.
    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]
        #When your application folder isn't in the system folder
    #This snippet prevents user access to the application folder
    #Rename 'application' to your applications folder name.
    RewriteCond %{REQUEST_URI} ^application.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    #Checks to see if the user is attempting to access a valid file,
    #such as an image or css document, if this isn't true it sends the
    #request to index.php
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
       ErrorDocument 404 /index.php
</IfModule>

控制器代码:

public function checklogin() {
    $this->load->helper('form');
    $this->load->helper('url');
    $this->load->library('session');

    $data = array(
        'email'  => $this->input->post('email'),
        'password'    => $this->input->post('password'),
    );
    print_r($data);
}

形式:

<form action="firstpage/checklogin" method="post" name="form1">
    <div class="row">
        <div class="col-md-12 responsive-center">
            <label for="login"> Email ID</label>
            <input type="text" id="login" value="" name="email" />
        </div>
    </div>
    <div class="row">
        <div class="col-md-12 responsive-center">
            <label for="login" style="color:#666666;float: left;">Password </label>
            <input type="password" id="password" value="" name="password"/>
        </div>
    </div>
    <div class="row">
        <div class="col-md-12 responsive-center">
            <input type="submit" value="Log In" id="submit" name="submita"/>
        </div>
    </div>
</form>

0 个答案:

没有答案