CI 묻고 답하기

제목 write 부분 질문 있습니다. 써지긴 써지는데요.
글쓴이 sjalove 작성시각 2013/09/27 18:37:32
댓글 : 2 추천 : 0 스크랩 : 0 조회수 : 13633   RSS
 컨트로러 부분입니다.


 public function write()
 {
   $this->load->view('vonetooneregister');  //view load 하기
 } 
 
 public function writepost()
 {
   $this->load->model('mcommon');  //모델 호출
   $data['result'] = $this->mcommon->write_entry(); //쓰기
 }
일단 함수 write부분에서 view 쓰는 곳 load하고 

그다음 writepost에서 model 호출 하고 model 함수 write_entry()로 갔습니다.

model부분입니다.


//write
    function write_entry()
    {       
       $this->title = $_POST['title'];
       $this->memo = $_POST['memo'];
       $this->name = $_POST['name'];
       $this->date = date("Y-m-d H:i:s",time());
        
       $this->db->insert('board', $this);
    }

일단 post로 정리하고 insert 했습니다.  여기서 질문이 있습니다.

써지긴 써집니다.문제는 date부분입니다.

오류 메세지는 
A PHP Error was encountered

Severity: Warning

Message: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone.

Filename: models/mcommon.php

Line Number: 21

이렇게 나옵니다. 결과값도 지금 날짜랑 틀리게 나옵니다. (시간만 틀림) 검색해서 알아봤는데 나라 시간 기준을 잡아야 한다고 하더군요.

어떻게 해야할지 모르겠네요 ㅠ,ㅠ 외국사이트 번역한거 참고했지만 모두 실패입니다 ㅠ,ㅠ

부탁합니다.

그럼 주말 잘 보내세요
 ^ ^ 








 다음글 result_array() 로 리턴시 text 필드는 ... (4)
 이전글 데이터베이스 관련 질문드려요~ (5)

댓글

에카 / 2013/09/27 19:03:29 / 추천 0
Hook부분, 혹은 컨트롤러 부분의 생성자부분에 date_default_timezone_set('Asia/Seoul'); 를 넣어보시거나, PHP의 timezone 설정에서 Asia/Seoul로 설정해보시고 다시 확인해보세요.
sjalove / 2013/09/27 23:07:26 / 추천 0
 감사합니다 ^ ^