Codeigniter显示日期功能的问题

ahs*_*ahs 0 codeigniter codeigniter-2

我想在db中插入值.我有一个表作为registration_patients.我的代码是:

$data = array(
    'patients_first_name' => $this->input->post('first_name'),
    'patients_last_name' => $this->input->post('last_name'),
    'patients_email' => $this->input->post('email'),
    'patients_password'=> $this->input->post('password'),
    'patients_birth_date'=> date('Y-m-d', strtotime($this->input->post('day') . "-" .$this->input->post('month') . "-" . $this->input->post('year'))),
    'patients_sex'=> $this->input->post('sex'),
    'patients_telephone'=> $this->input->post('telephone'),
    'patients_codice_fiscale'=> $this->input->post('codice_fiscale'),
    'account_active'=> 0
    );
    return $this->db->insert('registration_patients', $data);
Run Code Online (Sandbox Code Playgroud)

现在它将值插入数据库总线,显示一些错误和警告

遇到PHP错误

严重性:警告

消息:strtotime():依赖系统的时区设置是不安全的.您需要使用date.timezone设置或date_default_timezone_set()函数.如果您使用了这些方法中的任何一种并且仍然收到此警告,则很可能拼错了时区标识符.我们选择"欧洲/伦敦"代替"BST/1.0/DST"

文件名:models/doctors_model.php

行号:22遇到PHP错误

严重性:警告

消息:date():依赖系统的时区设置是不安全的.您需要使用date.timezone设置或date_default_timezone_set()函数.如果您使用了这些方法中的任何一种并且仍然收到此警告,则很可能拼错了时区标识符.我们选择"欧洲/伦敦"代替"BST/1.0/DST"

文件名:models/doctors_model.php

行号:22

Nil*_*l'z 7

在你的root_folder/index.php写作中date_default_timezone_set('America/New_York');,看看问题是否已经解决.这里是连接available timezones.