Laravel Form :: text不会生成确切的代码

时间:2015-10-06 07:35:44

标签: php laravel-5.1

修复laravel代码的位置

<input required="required" id="name" class="form-control" required="required" placeholder="Your name" name="name" type="text" />

它会生成

<input required="required" id="name" class="form-control" required="required" placeholder="Your name" name="name" type="text">

而不是

{{1}}

即以&#34; .. /&gt;&#34;结尾而不是&#34; ..&gt;&#34; ?有人知道吗?

2 个答案:

答案 0 :(得分:3)

检查FormBuilder类的输入函数的行258,它应该位于vendor/laravelcollective/html/src/FormBuilder.php

您应该将其更改为

return '<input' . $this->html->attributes($options) . '/>';

但是,您应该更好地扩展HTML类,然后修改FormBuilder类并在config/app.php文件中注册已修改的类,而不是修改供应商文件。

答案 1 :(得分:1)

There's nothing wrong for having a / at the ending. That's actually how it should. That is an html input. before input would be declare like

<input blah blah blah></input>

so <input blah blah /> is actually the shorthand of that . . I think