在控制器codeigniter中加载模型时,错误页面无法正常工作http错误500

时间:2016-10-11 03:34:08

标签: codeigniter models

加载页面时出现问题。它给我HTTP HTTP ERROR 500页面不起作用。这是我的代码。

class Availability extends CI_Controller
{
    private $username = null;
    private $role = null;
    private $member_id = null;
    private $logged_in = null;
    function __construct()
    {
        parent::__construct();
        $this->load->model('generic_model');
        $this->load->model('booking_model');
        $this->load->library('session');
        $this->load->helper('url');
        $this->load->helper('html');
        $this->load->helper('form');
        $this->load->helper('text');

        $this->username = $this->session->userdata('name');
        $this->role = $this->session->userdata('user_role');
        $this->member_id = $this->session->userdata('user_id');
        $this->logged_in = $this->session->userdata('logged_in');
    }

    public function index()
    {
        $data['slug'] = $this->uri->segment(1);
        $data['property_id'] = $this->uri->segment(2);
        $data['check_in'] = $this->uri->segment(3);
        $data['check_out'] = $this->uri->segment(4);
        $data['promo_code'] = $this->uri->segment(5);

        if (empty($data['property_id']) || $this->generic_model->is_property($data['property_id']) == FALSE) 
        {
            redirect(site_url());
        }

        if (empty($data['check_in']) || empty($data['check_out']) || $this->generic_model->is_older_date($data['check_in'],date('Y-m-d')) == TRUE || $this->generic_model->is_older_date($data['check_in'],$data['check_out']) == FALSE) 
        {
            $data['check_in'] = date('Y-m-d');
            // $inc_day_unix = strtotime("+1 days", strtotime($data['check_in']));
            $data['check_out'] = $this->generic_model->get_any_day($data['check_in'],'+1 day');
            redirect(site_url('availability/'.$data['property_id'].'/'.$data['check_in'].'/'.$data['check_out']));
        }

        $this->session->set_userdata('current_url',current_url());

        $this->load->model('admin_model');

        $data['property'] = $this->admin_model->get_property_detail($data['property_id']);
        $data['head_title'] = 'Availability - '.$data['property']->name;

        $data['menu'] = $this->generic_model->get_menu('frontend','header');
        $data['menu_footer'] = $this->generic_model->get_menu('frontend','footer');
        // $data['slider'] = $this->generic_model->get_slider($data['page']->page_id);
        $data['settings'] = $this->generic_model->get_settings();
        $data['username'] = $this->username;
        $data['logged_in'] = $this->logged_in;

        $data['properties'] = $this->generic_model->get_properties();
        $data['rooms'] = $this->booking_model->get_rooms_available($data['property_id'],$data['check_in'],$data['check_out'],$data['promo_code']);
        /*echo "<pre>";
        print_r($data['rooms']);
        echo "</pre>";*/
        $data['dates'] = $this->booking_model->get_table_dates($data['check_in'],$data['check_out']);
        $data['slider'] = $this->booking_model->get_slider($data['property_id']);
        $data['facilities'] = $this->booking_model->get_facilities($data['property_id']);
        $nights = $this->input->post('nights');
        $interval = $this->booking_model->get_interval($data['check_in'],$data['check_out']);
        $data['nights'] = !empty($nights) ? $nights : $interval;
        $data['viewer'] = $this->booking_model->get_viewer();
        $data['book_direct_benefits'] = $this->booking_model->get_booking_direct_benefits($data['property_id']);

        // print_r($data['rooms']);

        $this->load->view('frontend/traveler/page_head', $data);
        $this->load->view('frontend/booking/room_results', $data);
        // $this->load->view('frontend/traveler/modal');
        $this->load->view('frontend/traveler/footer');
        $this->load->view('frontend/traveler/js');
        $this->load->view('frontend/booking/result_js', $data);
        $this->load->view('frontend/traveler/closing_body_html');

        // no caching when back button is clicked
        $this->generic_model->no_cache();
    }

}

这是我的.htaccess

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]

当我在var_dump之前$this->load->model('admin_model');时它工作正常,但如果我在此之后给var_dump,我会Page isn't working HTTP ERROR 500

我的CI文件位于public_html/v3

请帮我解决这个问题。谢谢。

0 个答案:

没有答案