本文介绍了数组的旧输入?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有foreach
,在foreach
内部,我有这样的输入:
I have foreach
and inside foreach
i have input like this:
<input type="text" id="text-title" name="article_title[{{$language->code}}]" value="{{ old('article_title[$language->code]') }}" class="form_input" />
我正在尝试像这样添加旧的输入,但无法正常工作.有什么建议我该如何将old用于数组?
Im trying to add old input like this but its not working. Any suggestion how can i use old for array?
我也试过了,但是也没用:
Also i tried this but also not working:
<input type="text" id="text-title" name="article_title[{{$language->code}}]" value="{{ old('article_title.0') }}" class="form_input" />
我只对第一次迭代有验证,如果对您有意义的话.
I have validation only for first iteration if that means anything for you.
推荐答案
您应该可以从语言代码中访问索引:
You should be able to access the index off of your language code:
value="{{ old('article_title.'.$language_code) }}"
这篇关于数组的旧输入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!