奇怪的行为,WAMP - Codeigniter

Strange behaviour, WAMP - Codeigniter

背景 : 我将一个 Codeigniter 项目从 Windows 7 迁移到 Windows 10,在 Windows 7 中,我正在使用手册安装 Apache,PHP,Mysql 但在 Windows 10 我安装了 WAMP。这里要注意的是 mysqli 在这个新设置中不起作用,我已经尝试了很多事情并在这里提出了问题但无济于事。所以我现在正在和 mysql 一起工作。

问题:我开始测试网站(已迁移的项目)的功能,发现注册无法正常工作,但在windows 7设置。表单正在提交给持有表单 html 的同一控制器。当用户单击提交按钮时,jquery 会做一些事情然后 returns true 让表单被提交。

问题是,控制器确实加载以响应表单提交,但没有 post 数据,但是如果我将操作 url 更改为测试脚本,它表明表单正在正确提交并且 post 数据在那里。

在 application/config/routes.php 重新路由:

$route['(?i)Signup/(:any)'] = 'Signup/index/';

控制器:

public function index ( $key = NULL )
{
    /** Does nothing */
    if ($_SERVER['REQUEST_METHOD'] == 'POST') print_r($_POST);

    if (  isset ( $key )  )
    {
       return $this->_key( $key );
    }
    /** Register. */
    if (   $this->input->post ( 'register_user' )  )
    {
        echo 'register_user';
        return $this->_register (  );
    }
    /** File upload Ajax call. */
    else if (  ! $this->input->post ( 'register_user' )  &&  $this->input->post ( 'gender' ) && $this->input->post ( 'ajaxUpload' )  )
    {
        echo 'ajaxUpload';
        echo $this->_upload (  );
    }
    /** Email Validation Ajax Call. */
    else if (  ! $this->input->post ( 'register_user' )  &&  $this->input->post ( 'email_validation' )  &&  $this->input->post ( 'email' )  )
    {
        echo 'email_validation';
        echo $this->_email_available (  );
    }
    /** Default view. */
    // If I submit form or not, this section is what gets executed
    else 
    {
        echo 'else';
        $this->_default (  );
    }
}

查看文件:

<form id="sign_up" action="<?php echo site_url (  ) . $this->router->fetch_class (  ) ;?>" method="post" accept-charset="utf-8" enctype="multipart/form-data">
    <input id="register_user" type="hidden" name="register_user" value="Submit" />
    ---
    ---
    <button type="submit" name="register_user" id="register_user" value="Submit">Submit</button>
</form>

JavaScript 文件: var sentinel = false;

$( '#sign_up' ).submit ( function ( event ) {
    if ( ! sentinel )
    {
        var scriptUrl = $ ( '#sign_up' ).attr ( 'action' );
        var data = new FormData (  );
        /* Appaend form data with the formData object */
        ---
        ---

        $.ajax ( {
            method : 'POST', url : scriptUrl, data : data, cache : false, processData: false, contentType: false, dataType : 'json',
            success : function ( data, textStatus, jqXHR ) { 

                /** Success uploading file, File saved to the server and server did not set the data.error variable/key. */
                if ( typeof data.error === 'undefined' )
                {
                    /** DO stuff */

                    sentinel = true;
                    $( '#sign_up' ).submit (  );
                }
                else
                {
                    /** Set error message and do nothing. */
                }
            },
            error : function ( jqXHR, textStatus, errorThrown ) 
            {
                alert (  jqXHR.responseText  );
            }

        } );
    }

    // return false - cancels original submits until allowed
    // returns true - allows a triggered submit
    return sentinel;
}

问题出在 mod_rewrite。一旦我取消注释 Apache 的 httpd.conf 文件中的 LoadModule rewrite_module modules/mod_rewrite.so 行,如果安装了 Apache,它位于 conf 目录中,它就起作用了。