.htaccess 如何使用Htaccess更改laravel paginate的Url格式

.htaccess 如何使用Htaccess更改laravel paginate的Url格式,.htaccess,laravel,laravel-5.2,url-routing,laravel-5.3,.htaccess,Laravel,Laravel 5.2,Url Routing,Laravel 5.3,如何将Laravel页面呈现url更改为此格式 http://exampel.com/articles?page=1 到 您应该自己实现分页或使用包含的分页 这是文件 还是简单的实现 您应该指定路由,从数据库(或任何您想要的地方)获取结果,而不是切片结果数组 Route::get('articles/page/{id}', function ($id) { $articles = Article::all(); $count = 15; //how many ite

如何将Laravel页面呈现url更改为此格式

http://exampel.com/articles?page=1


您应该自己实现分页或使用包含的分页

这是文件

还是简单的实现

您应该指定路由,从数据库(或任何您想要的地方)获取结果,而不是切片结果数组

Route::get('articles/page/{id}', function ($id) {
    $articles = Article::all(); 
    $count = 15; //how many items per page
    //of course you should check if $id is not < 0 etc... 
    return view()->with([
        'articles' => array_slice($articles, $id*$count, $count)
   ])
});
Route::get('articles/page/{id}',函数($id){
$articles=Article::all();
$count=15;//每页有多少项
//当然,您应该检查$id是否不小于0等。。。
返回视图()->带有([
“articles'=>数组\u切片($articles,$id*$count,$count)
])
});

无法使用htaccess?这可能有助于@CannotFindSymbol为什么在htaccess中可以使用自定义代码|下面是您可能感兴趣的内容(要重定向的服务器配置)。现在确定要如何实现它
Route::get('articles/page/{id}', function ($id) {
    $articles = Article::all(); 
    $count = 15; //how many items per page
    //of course you should check if $id is not < 0 etc... 
    return view()->with([
        'articles' => array_slice($articles, $id*$count, $count)
   ])
});