我不能展示拉拉分页。它给出了一个未定义的错误方法stdClass::links(),我使用了render方法,但是给出了一个未定义的错误方法stdClass::render()
这是我的密码
<?php $products = DB::table('products')->where('category_id',$category-> id)->paginate(4); ?>
@foreach($products as $products)
<li class="product-item col-md-3 col-sm-6 col-xs-12">
<div class="product-inner">
<div class="thumb has-second-image">
<a href="#">
@if(empty($products-> medium_product_image))
{{ HTML::image('images/no-image.gif',$products-> product_name) }}
@else
{{ HTML::image($products-> medium_product_image,$products-> product_name) }}
@endif
</a>
</div>
<div class="info">
<h3 class="product-name short"><a href="#">{{ $products-> product_name }}</a></h3>
<span class="price">{{ $products-> product_price }}</span>
<del>{{ $products-> product_old_price }}</del>
</div>
</div>
</li>
@endforeach
<nav class="pagination navigation">
<ul class="page-numbers">
<li>{!! $products-> links() !!}</li>
</ul>
发布于 2016-06-28 14:47:18
请将该行@foreach($products as $products)更改为@foreach($products为$product)。我认为错误是由于相同的变量名造成的。
发布于 2016-06-28 13:40:13
试着
{!! $products->render() !!}而不是
{!! $products-> links() !!}https://stackoverflow.com/questions/38077051
复制相似问题