yang kuat yang membolehkan anda melampirkan coretan URL ke pautan paging. Ciri ini amat berguna apabila mengarahkan pengguna ke bahagian tertentu halaman semasa navigasi. fragment()
Kaedah dengan lancar diintegrasikan dengan sistem paging Laravel: fragment()
$users = User::paginate(15)->fragment('users');
#users
kaedah
fragment()
class ContentController extends Controller { public function index(Request $request) { $activeSection = $request->section ?? 'recent'; return View::make('content.index', [ 'posts' => Post::latest() ->paginate(10) ->fragment("section-{$activeSection}"), 'activeSection' => $activeSection ]); } } // views/content/index.blade.php <div id="section-{{ $activeSection }}"> @foreach ($posts as $post) @endforeach {{ $posts->links() }} </div>
Atas ialah kandungan terperinci Menggabungkan serpihan URL dalam penomboran Laravel ' s. Untuk maklumat lanjut, sila ikut artikel berkaitan lain di laman web China PHP!