如何在 CakePHP 应用程序的主页上放置表单?
刚刚开始开发 CakePHP。我的应用程序的主页应该有一个表单,这个表单有一个相应的模型和控制器。
我应该在哪里放置此表单的视图代码,以便它出现在应用程序主页上并在提交时调用正确的控制器操作?
非常感谢。
Just begun developing CakePHP. The homepage of my application is meant to have a form, this form has a corresponding model and controller.
Where do I place the view code for this form in order for it to appear on the application homepage and call the correct controller action when submitted?
Many Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它通常位于
app/views/pages/
目录中。页面视图/控制器主要用于提供静态内容。但是,您可以通过修改app/config/routes.php
并添加类似于以下内容的行来轻松更改用于呈现主页的代码:有关更多信息,您可以查看:
http://book.cakephp.org/view/958/The-Pages-Controller
http://book.cakephp.org/view/945/Routes-Configuration
That's normally located in the
app/views/pages/
directory. The pages view/controller is used primarily to serve static content. However, you can easily change the code used to render the home page by modifyingapp/config/routes.php
and adding a line similar to:For more info, you can check out:
http://book.cakephp.org/view/958/The-Pages-Controller
http://book.cakephp.org/view/945/Routes-Configuration