📜  laravel 循环变量 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:53:46.490000             🧑  作者: Mango

代码示例3
@foreach($listdata as $data)
      // iteration ascending (1,2,3,...)
        {{ $data->firstItem() + $loop->index }}

    // iteration descending (...,3,2,1)
        {{ ($data->total()-$loop->index) - (($data->currentpage()-1) * $data->perpage()) }}
@endforeach