简体   繁体   English

代码点火器更新无法立即在服务器上运行

[英]Code Igniter Update not working immediately on server

I'm facing a rather strange problem with this..我正面临着一个相当奇怪的问题。

I'm working on a Yellowpages website using Code Igniter and MySQL.我正在使用 Code Igniter 和 MySQL 开发一个 Yellowpages 网站。 Everything works fine on my local machine, but I face a problem when uploaded to my server.在我的本地机器上一切正常,但上传到我的服务器时遇到问题。

The only problem being:唯一的问题是:

When I make change some changes and press the update button, the changes are immediately shown in the view (Have also checked that it gets updates in the Database).当我进行一些更改并按下更新按钮时,更改会立即显示在视图中(还检查了它是否在数据库中获得更新)。 However, if I press the 'Edit' button again within say 5-10 seconds the changes are undone.但是,如果我在 5-10 秒内再次按下“编辑”按钮,更改将被撤消。

The most interesting fact being, even if I press update with the old changes...come and check in a few hours.最有趣的事实是,即使我按旧更改进行更新...也请过几个小时来检查一下。 I see the new values again.我再次看到了新的价值观。

I really don't know whats wrong.我真的不知道怎么了。

Here are my codes :这是我的代码:

Controller控制器

function customerList()
    {
        $data = array();
        $data = $this->footer_images();

        $this->load->library('pagination');

        if($this->session->userdata('user_role') == "Admin" || $this->session->userdata('user_role') == "Employee")
        {
            if($this->session->userdata('user_role') == "Admin")
                $cond = array('enabled' => 1,'approve' => 1);
            else if($this->session->userdata('user_role') == "Employee")
                $cond = array('enabled' => 1,'approve' => 1,'branch' => $this->session->userdata('branch'));

            $config = array();

            $config["base_url"] = base_url() . "home/customerList";
            $config["total_rows"] = $this->companies->count_entry($cond,"companies");
            $config["per_page"] = 10;
            $config["uri_segment"] = 3;
            $config["num_links"] = 3;
            $config["full_tag_open"] = '';
            $config["full_tag_close"] = '';
            $config["cond"]=$cond;

            $this->pagination->initialize($config);

            $off=$this->uri->segment(3);

            if($off=="" && !isset($_POST['off']))
                $off=0;
            else if(isset($_POST['off']))
                $off=$this->input->post("off");
            else
                $off=$this->uri->segment(3);

            $data["customers"] = $this->companies->get_data_with_cond_page($config["per_page"], $off, $config["cond"]); 


            $content_data['content'] = $this->load->view("customerList",$data,TRUE);

            if($this->session->userdata('user_role') == "Admin")
                $this->load->view('masterTemplate/adminTemplate',$content_data);                
            else if($this->session->userdata('user_role') == "Employee")
                $this->load->view('masterTemplate/employeeTemplate',$content_data);
        }
        else
        {
            $data['signup_error'] = "OK";
            $content_data['content'] = $this->load->view("home",$data,TRUE);
            $this->load->view("masterTemplate/template",$content_data);
        }
    }


    function editCompany()
    {

        $data = array();
        $data = $this->footer_images();

        $slno = $this->uri->segment(3);

        $cond = array('slno' => $slno);
        $data['results'] = $this->companies->get_data_with_cond($cond);
        $data['category'] = $this->category->get_all_data();
        //// $data['subcategory'] = $this->subcategories->get_all_data();

        /*  $data['makeColumns'] = $this->makeColumns1();
        $data['getTotalData'] = $this->getTotalData("category","");
        $data['perPage'] = $this->perPage(); */
        $data['category'] = $this->category->get_all_data();

        if($this->session->userdata('user_role') == "Admin")
        {
            $this->load->view('template/Admin/header');
            $this->load->view("edit_company",$data);
            $this->load->view('template/Admin/footer',$data);
        }

    }

    function updateCompany()
    {
        $this->form_validation->set_rules('company_name', 'Company Name', 'required');
        $this->form_validation->set_rules('category', 'Category', 'required');

        if ($this->form_validation->run() == FALSE)
        {
            $sl = $this->input->post('slno');
            redirect("home/editCompany/$sl?stat=err");          
        }
        else
        {
                $data = array(
                                'company_name' => $this->input->post('company_name'),
                                'contact_person' => $this->input->post('contact_person'),
                                'address' => $this->input->post('address'),
                                'city' => $this->input->post('city'),
                                'state' => $this->input->post('state'),
                                'landmarks' => $this->input->post('landmarks'),
                                'pincode' => $this->input->post('pincode'),
                                'std_code' => $this->input->post('std_code'),
                                'mobile' => $this->input->post('mobile'),
                                'phone' => $this->input->post('phone'),
                                'fax' => $this->input->post('fax'),
                                'cmail' => $this->input->post('cemail'),
                                'website' => $this->input->post('website'),
                                'category_name' => $this->input->post('category')
                            );

                $cond = array(
                            'slno' => $this->input->post('slno')
                         );




                        if($this->companies->update_data($cond,$data))
                        {
                            redirect("home/customerList?stat=ok");
                        }
                        else
                        {
                            redirect("home/customerList?stat=nok");
                        }

        }
    }

Model模型

function update_data($cond,$data)
    {
        $this->db->where($cond)->update('companies',$data);
        return true;
    }

An early help will be truly appreciated.早期的帮助将不胜感激。 Thanks!谢谢! :) :)

It seems I had a problem with the Page Cache.看来我的页面缓存有问题。 Once I used the no-cache formula...it worked.一旦我使用了无缓存公式......它就起作用了。 Now, Running good too.现在,运行良好。

尝试在更新后按 control+f5 刷新缓存

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM