希望你们中的一位能帮助我解决问题。
我收到一个错误,告诉我我没有在 in_array() 中使用数组。
使用 pluck() 应该会给我一个数组,对吧?
{{ Request::ip() }}
{{ $pug->ipbans->pluck('ip') }}
Output:
127.0.0.1
["127.0.0.1","127.0.0.1"]
然后在刀片中:
@if( in_array( Request::ip(), $pug->ipbans->pluck('ip') ) )
<div class="alert alert-danger">
Your IP has been blocked on this page. Changes not allowed.
</div>
@endif
我收到以下错误:
in_array() expects parameter 2 to be array, object given (View: ...)
所以它告诉我这$pug->ipbans->pluck('ip')不是一个数组 - 但它是,对吗?
有只小跳蛙
皈依舞
慕工程0101907