我在刀片模板中使用$softwarelist
时有两个数组$virt_software_select
和@foreach
,如下面的代码我已经检查但$softwarelist
标签是双倍的。
$softwarelist =["Adobe Photoshop","Adobe Illustrator","Corel Draw","My SQL","Oracle"];
$virt_software_select=["Adobe Photoshop","My SQL"];
@foreach($softwarelist as $slst)
@foreach($virt_software_select as $sw_usr)
@if($slst->software==$sw_usr->virtualize_software)
<label>
<input type="checkbox" checked name="virt_software[]" value="{{$slst->software}}"/>
{{$slst->software}}
</label>
@else
<label>
<input type="checkbox" name="virt_software[]" value="{{$slst->software}}"/>
{{$slst->software}}
</label>
@endif
@endforeach
@endforeach
我得到了这些
如何在两个数组中检查相同的数据,而不是在laravel中检查$softwarelist
的双数据?