dongpiao9078
dongpiao9078
2013-03-05 00:57
浏览 53
已采纳

CakePHP提交表单:链接与发布方法

I'd like to obtain some opinions about using link vs post form method types. For example, if I have a controller searches that finds products at the URL /searches/products, there are two ways to make this work.

With the link method, I can grab the data from $this->params['url'] as an array. With post, I can get them in $this->params['form'] using hidden form elements. This is assuming I am not using the CakePHP Form Helper. With the post method, the search string can be an argument for the action, so it seems like the way to go, but when would you ever go with the link method when submitting data?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dongzhuo1733
    dongzhuo1733 2013-03-05 04:19
    已采纳

    If it's actually a search, I would almost always go w/ the URL method. It allows people to bookmark their results.

    点赞 评论

相关推荐