Laravel 5.1 查询字符串参数在分页中不起作用
Laravel 5.1 query string parameter not working in pagination
我正在使用 laravel 5.1 分页。但它不起作用。我想问题是访问查询字符串参数。
routes.php
Route::get('blogs', 'front\FrontController@blog');
控制器
public function blog(Request $request)
{
print_r($request->fullUrl());
die;
$blogs=Blog::with('User')->where('flag','!=','0')->paginate(2);
return view('front.pages.blog_list',['blogs'=>$blogs]);
}
对于urlhttp://localhost/myproject/blogs?page=2
结果:http://localhost/myproject/blogs?blogs。它应该在哪里?page=2 而不是?blogs。我还注意到查询字符串参数在其他页面中也不起作用。任何的想法?提前致谢。
使用->appends(\Input::except('page'))
return view('front.pages.blog_list',[
'blogs'=>$blogs->appends(\Input::except('page'))
]);
原因是 .htaccess 文件。
我正在使用 laravel 5.1 分页。但它不起作用。我想问题是访问查询字符串参数。
routes.php
Route::get('blogs', 'front\FrontController@blog');
控制器
public function blog(Request $request)
{
print_r($request->fullUrl());
die;
$blogs=Blog::with('User')->where('flag','!=','0')->paginate(2);
return view('front.pages.blog_list',['blogs'=>$blogs]);
}
对于urlhttp://localhost/myproject/blogs?page=2
结果:http://localhost/myproject/blogs?blogs。它应该在哪里?page=2 而不是?blogs。我还注意到查询字符串参数在其他页面中也不起作用。任何的想法?提前致谢。
使用->appends(\Input::except('page'))
return view('front.pages.blog_list',[
'blogs'=>$blogs->appends(\Input::except('page'))
]);
原因是 .htaccess 文件。