email 字段渲染一个单行文本框,其类型为 email,在移动浏览器中触发一个专用于电子邮件的键盘。
user_email:
label: Email Address
type: email以下 字段属性 是常用的。
| Property | Description |
|---|---|
| label | a name when displaying the form field to the user. |
| placeholder | text to display in the field when it is empty. |
| default | specifies a default string value, optional. |
| comment | places a descriptive comment below the field. |
如果您想在保存时验证此字段以确保它是一个格式正确的电子邮件地址. 在使用定制字段时, 请使用 validation 属性.
user_email:
label: Email Address
type: email
validation: email在使用模型时,在您的模型上使用 $rules 属性,如下所示。
public $rules = [
'user_email' => ['email'],
];有关模型验证的更多信息,请访问验证服务文章。