我在为我的网站上的照片添加评论时遇到问题。在评论表中,我有:
id, user_id, photo_id, content, created, modified, erased.
在视图中我创建:
echo $this->Form->create('Comment');
echo $this->Form->input('title');
echo $this->Form->input('content');
echo $this->Form->input($this->Session->read('User.id'), array('type'=>'hidden'));
echo $this->Form->input($photo['Photo']['id'], array('type'=>'hidden'));
echo $this->Form->end('Add comment');
我不知道这是否是正确的方法。cake 如何知道 2 个隐藏值是user_id和photo_id?
谢谢你的建议。