我在codeigniter中遇到错误

时间:2022-10-14 20:27:39

Normally in core php if we try to make a request using ajax we set url of the file where the query exist so when switching same process in codeigniter but I got an error in response can anyone help me out with this error

通常在核心php中,如果我们尝试使用ajax发出请求,我们设置查询存在的文件的url,所以当在codeigniter中切换相同的进程但我收到错误响应时,任何人都可以帮我解决这个错误

net::ERR_SSL_PROTOCOL_ERROR

网:: ERR_SSL_PROTOCOL_ERROR

here is my code Javascript ajax

这是我的代码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);
                        });
                    }
                }
            });

Here is the code form my Home.php controller

这是我的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';
        }
    }

Please let me know how can i get rid of this error

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

2 个解决方案

#1


2  

Your localhost is not conforming https protocol

您的localhost不符合https协议

Change the url from https://localhost:90/tufuturo/home/register to http://localhost:90/tufuturo/home/register

将网址从https:// localhost:90 / tufuturo / home / register更改为http:// localhost:90 / tufuturo / home / register

If you want to work with https protocol you need to generate certificate

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

#2


0  

If you use SSL(https), maybe you need take :90 out of your url.

如果你使用SSL(https),也许你需要:你的网址是90。

#1


2  

Your localhost is not conforming https protocol

您的localhost不符合https协议

Change the url from https://localhost:90/tufuturo/home/register to http://localhost:90/tufuturo/home/register

将网址从https:// localhost:90 / tufuturo / home / register更改为http:// localhost:90 / tufuturo / home / register

If you want to work with https protocol you need to generate certificate

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

#2


0  

If you use SSL(https), maybe you need take :90 out of your url.

如果你使用SSL(https),也许你需要:你的网址是90。