htmlspecialchars() 期望参数 1 为字符串,给定数组(查看:/opt/lampp/htdocs/SED/resources/views/reports/log_print.blade.php)

问题描述 投票:0回答:1

htmlspecialchars() 期望参数 1 为字符串

在实际环境中获取日志报告时出现此错误。并不是所有的报告,而是一些报告

这是我在控制器中的

participateOfficersArray

array_push($participateOfficersArray, [
    'officer_id'       => $officer_id,
    'officer_name'     => $officer_name,
    'officer_position' => $officer_position,
    //''date' => $participateOfficer->officer_dates,
    'date'             => $officerDaysArray,
]);

这是刀片文件:

@foreach($participateOfficersArray as $participateOfficersArray)
    <tr>
        <td>{{$participateOfficersArray['officer_id']}}</td>
        <td>
            <div class="editable">{{$participateOfficersArray['officer_name']}}</div>
        </td>
        <td>
            <div class="editable">{{$participateOfficersArray['officer_position']}}</div>
        </td>
        <td>
            <table>
                @foreach($participateOfficersArray['date'] as $officerDaysArray)
                    <tr>
                        <td>{{$officerDaysArray}}</td>
                    </tr>
                @endforeach
            </table>
        </td>
    </tr>
@endforeach
php laravel laravel-blade
1个回答
0
投票

这应该适合你

试试这个:

@foreach($participateOfficersArray as $item)
    <tr>
        <td>{{$item['officer_id']}}</td>
        <td>
            <div class="editable">{{$item['officer_name']}}</div>
        </td>
        <td>
            <div class="editable">{{$item['officer_position']}}</div>
        </td>
        <td>
            <table>
                @foreach($item['date'] as $officerDaysArray)
                    <tr>
                        <td>{{$officerDaysArray}}</td>
                    </tr>
                @endforeach
            </table>
        </td>
    </tr>
@endforeach
© www.soinside.com 2019 - 2024. All rights reserved.