我在代码点火器中出错

I am getting error in codeigniter

本文关键字:出错 点火器 代码      更新时间:2023-09-26

通常在core php中,如果我们试图使用ajax发出请求,我们会设置查询所在文件的url,因此当在codeigniter中切换相同进程时,但我在响应中出现错误,有人能帮我解决这个错误吗?

net::ERR_SSL_PROTOCOL_ERROR

这是我的代码Javascript ajax

$.ajax ({
                type     : "POST",
                url      : "https://localhost:90/tufuturo/home/register",
                data     : {username: username, email: email, password: confirm_password},
                dataType : "text",
                success  : function(data, text, xhr) {
                    if(xhr == 200) {
                        var return_data = data;
                        $('#messagebox').fadeIn(2000, function() {
                            $(this).html("<div class='message'>"+return_data+"</div>").delay(4000).fadeOut(3000);
                        });
                    }
                }
            });

这是我的Home.php控制器的代码

public function register() {
        $this->load->library('form_validation');
        $this->form_validation->set_rules('username', '', 'required|trim|is_unique[users.username]');
        $this->form_validation->set_rules('password', '', 'md5|trim');
        if($this->form_validation->run()) {
            $data = array(
                'username'   => $this->input->post('username'),
                'password'   => $this->input->post('password'),
                'email'      => $this->input->post('email'),
                'type'       => 'user'
            );
            $this->data_insert->add_admin($data);
            echo 'New admin has been successfully created';
        } else {
            echo 'Username already taken';
        }
    }

请让我知道如何摆脱这个错误

您的本地主机不符合https协议

更改https://localhost:90/tufuturo/home/register的url至http://localhost:90/tufuturo/home/register

如果您想使用https协议,您需要生成证书

如果你使用SSL(https),也许你需要从你的url中去掉:90。