gpt4 book ai didi

php - Laravel 4 表单文本输入

转载 作者:可可西里 更新时间:2023-11-01 12:25:39 25 4
gpt4 key购买 nike

您好,我目前正在使用 Laravel 4 表单。我正在努力生成具有特定类的文本输入而不选择“默认值”。我想执行以下操作:

{{ Form::text('first_name', array('class' => 'first_name')) }}

但是我得到这个错误(htmlentities() expects parameter 1 to be string, array given.)除非我添加默认值:

{{ Form::text('first_name', 'Some Value', array('class' => 'first_name')) }}

然后默认值会填充该字段,需要在输入新值之前将其删除。所以它甚至不能用作占位符。

提前谢谢你,

最佳答案

提供 null 而不是值。 (不要提供空字符串 "")

如果您要使用表单模型绑定(bind) (http://laravel.com/docs/html#form-model-binding),这将在未来派上用场,因为 null 将给出给定模型属性的值。

关于php - Laravel 4 表单文本输入,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19683380/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com