表单助手:任何其他好处? [英] Form Helper: Any other benefit?

查看:105
本文介绍了表单助手:任何其他好处?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新的codeigniter,我刚刚创建了一个测试登录系统。 Chuffed ...

I am new to codeigniter and I have just created a test login system. Chuffed...

我想为此登录系统创建一个表单,因为我刚刚直接传递用户名/密码进行测试。

I would like to make a form for this login system as I have just been passing the username/password directly for testing.

我试图解决使用表单助手的好处。它帮助我轻松地调整一个表单,但我不能这样做只是纯粹的HTML?还有form helper的另一个好处 - 我只是在谈论创建表单而不是验证的部分 - 我猜我可以使用验证,而不管表单是如何创建的。

I am trying to work out the benefits of using the form helper. It helps me contsruct a form easily but can I not do this in just pure html? Is there another benefit of the form helper - I am just talking about the part that creates the form and not the validation - I am guessing I can use the validation regardless of how the form was created?

感谢所有

推荐答案

表单助手的作用是让您对表单进行编程控制。是的,你可以用HTML编写,但是当你想自动填充需要在提交之间持续的字段和其他类似的表单常见的东西时,你会发现自己将PHP插入你的HTML。使用此助手将尽可能保持您的逻辑在控制器,并从您的意见。

The form helper exists to give you programmatic-control over your form. Yes, you could write it in HTML, but then you'll find yourself inserting PHP into your HTML when you want to auto-populate fields that need to persist between submissions and other similar stuff that is common to forms. Using this helper will keep your logic in the controller, and out of your views as much as possible.

顺便说一下,好的选择学习MVC!

By the way, good choice learning MVC!

这篇关于表单助手:任何其他好处?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆