Codeigniter在加载模型时转储Model-Class

时间:2014-01-27 15:12:02

标签: php codeigniter

使用Codeigniter(2.1.4)获得了一些奇怪的行为:

我一直插入模型

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

页面不再呈现,但我得到了类的内容。 不要得到我做了什么来得到这种行为。只是插入数据库凭据。 如果我不加载模型,一切正常...... 除了针对BaseURL的config.php和用于凭据的密钥和database.php之外,没有触及任何内容......

Modelclass:

class Enrollment extends CI_Model {

    function __construct()
    {
        // Call the Model constructor
        parent::__construct();
    }
}

控制器:

<?php

class Anmeldung extends CI_Controller {

function __construct()
{
    parent::__construct();
    $this->load->model('Enrollment');
}

function index()
{
    $this->load->helper('url');
    $this->load->library('form_validation');

    $this->form_validation->set_rules('days','Tage','callback_checkDays');
    $this->form_validation->set_message('checkDays', 'Es muss mindestens 1 Tag ausgewählt werden.');

    $this->form_validation->set_rules('company_name','Unternehmen','required');
    $this->form_validation->set_rules('participant_firstname','Vorname','required');
    $this->form_validation->set_rules('participant_lastname','Nachname','required');
    $this->form_validation->set_rules('participant_departement','Funktion','required');
    $this->form_validation->set_rules('participant_email','Email','required|valid_email');

    $this->form_validation->set_rules('company_address_street','Straße','required');
    $this->form_validation->set_rules('company_address_zipcode','Postleitzahl','required');
    $this->form_validation->set_rules('company_address_city','Straße','required');
    $this->form_validation->set_rules('company_address_country','Land','required');

    $this->form_validation->set_rules('agreement','Datenschutz','callback_checkAgreement');
    $this->form_validation->set_message('checkAgreement', 'Bitte stimmen Sie unseren Teilnahme Bedingungen zu.');

    if ($this->form_validation->run() == FALSE)
    {
        $this->load->view('anmeldung');
    }
    else
    {
        return "true";
    }
}

function checkDays() {
    $data = $this->input->post('days');
    //mindestens ein feld muss true sein
    if($data[0] == 1 || $data[1] == 1 || $data[2] == 1) return true;
    else return false;
}

function checkAgreement() {
    $data = $this->input->post('agreement');
    if($data[0] == 0 || $data[1] == 0) return false;
    else return true;
}
}
?>

0 个答案:

没有答案