laravel刀片中每个循环的非法偏移字符串

时间:2017-06-14 20:47:38

标签: php laravel-5.3

如何从'中解决此非法偏移字符串?我的laravel刀片错误。我正在使用此集合向其发送数据

  $results = [
            'name'          => $Fname,                  
            'from'          => $from,
            'to'            => $to,
            ];  

并且在刀片中:

@foreach($results as $result)
            <tr>
            <td>{{ $result['from'] }}</td>
           <td>{{ $result['to'] }}</td>
         <td>{{ $result['name'] }}</td>
    </tr>
@endforeach     

1 个答案:

答案 0 :(得分:0)

$结果需要[]在&#39; =&#39;之前。

$results[] = [
'name'          => $Fname,                  
'from'          => $from,
 'to'           => $to,
];