dongpu8935 2016-11-19 16:35
浏览 55
已采纳

laravel解析视图错误

I'm getting Parse error: syntax error, unexpected '->' (T_OBJECT_OPERATOR), expecting ',' or ')' on my view file. This is my controller:

public function gclogs()
    {
      $gclogs = DB::table('duplicategcs')->orderBy('created_at', 'desc')->paginate(20);
        return view('admin.gclogs')->with('gclogs',$gclogs);

    }

and this is just a snippet from view:

@foreach($gclogs as $gclog)
                            <tr>
                              <td>
                                {{gclog->id}}
                              </td>
                              <td>
                                {{gclog->user_id}}
                              </td>
                              <td>
                                {{gclog->google_id}}
                              </td>
                              <td>
                                {{gclog->google_email}}
                              </td>
                              <td>
                                {{gclog->created_at}}
                              </td>
                              <td>
                                <a href="{{url('admin/users/')}}/{{gclog->user_id}}">User Edit</a>
                              </td>
                            </tr>

                            @endforeach
                              </tbody>
                            </table>
                            <div align="center">
                              {{ $gclogs->render() }}
                            </div>
  • 写回答

1条回答 默认 最新

  • dthp96899 2016-11-19 16:46
    关注

    You forget use $ inside foreach.

    Try this:

    @foreach($gclogs as $gclog)
    <tr>
      <td>
        {{$gclog->id}}
      </td>
      <td>
        {{$gclog->user_id}}
      </td>
      <td>
        {{$gclog->google_id}}
      </td>
      <td>
        {{$gclog->google_email}}
      </td>
      <td>
        {{$gclog->created_at}}
      </td>
      <td>
        <a href="{{url('admin/users/')}}/{{$gclog->user_id}}">User Edit</a>
      </td>
    </tr>
    
    @endforeach
      </tbody>
    </table>
    <div align="center">
      {{ $gclogs->render() }}
    </div>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 java 的protected权限 ,问题在注释里
  • ¥15 这个是哪里有问题啊?