我的网站包含评论表单Post
。如何在id
评论控制器方法中收到add()
帖子?
THX!
答案 0 :(得分:2)
如果模型绑定正确(Post hasMany Comment,Comment belongsTo Post),你可以这样做:
/views/comments/add.ctp或/views/posts/view.php:
<?php echo $this->Form->input('post_id', array('type' => 'hidden', 'value' => $post['Post']['id'])); ?>