방금 CakePHP를 배우기 시작했고 공식 블로그 튜토리얼을 시작했습니다. 지금까지는 그렇게 좋았지 만 뷰에서나 컨트롤러에서이 필드를 가리키는 라인이 없기 때문에 현재와 수정 된 시간이 db로 저장되는 방법을 얻지 못하고있다. 여기 CakePHP의 블로그 자습서에서 현재 시간과 수정 시간은 어떻게 저장됩니까?
은 추가에 대한 PostsController.php 코드 :public function add()
{
if($this->request->is('post'))
{
$this->Post->create();
if($this->Post->save($this->request->data))
{
$this->Session->setFlash(__('Your post has been saved.'));
return $this->redirect(array('action' => 'index'));
}
else
{
$this->Session->setFlash(__('Unable to add your post.'));
}
}
}
그리고 여기 add.ctp보기 코드 :
이<!-- File: /app/View/Posts/add.ctp -->
<?php echo $this->Html->link('Home', 'index/home'); ?>
<h1>Add Posts</h1>
<?php
echo $this->Form->create('Post');
echo $this->Form->input('title');
echo $this->Form->input('body', array('rows' => '3'));
echo $this->Form->submit('Add Post', array('name' => 'add_post'));
//echo $this->Form->end('Save Post');
?>
그래서 사람이 현재 시간을 절약하는 라인을 말씀 해주십시오? 도와 줘서 고마워.
당신에게 벤 감사드립니다. 너는 내 의심에 정확하게 대답했다. 다시 한번 감사드립니다. –