作者 邓超

v2

... ... @@ -71,6 +71,23 @@ class Index extends Base
/**
* 单页
* @param $key
* @author:dc
* @time 2022/12/28 16:59
*/
public function page($key){
$page = $this->getData('page',['urlkey'=>$key]);
if(!$page){
return redirect('/');
}
return response($page,200,['Content-Type'=>'text/html charset=urt-8;']);
}
}
... ...
... ... @@ -65,6 +65,6 @@ Route::get('/blogs', [\App\Http\Controllers\V2\Index::class,'blog']);
// 博客详情
Route::get('/blog/{id}', [\App\Http\Controllers\V2\Index::class,'blog_info'])->where('id','\d+');
// 单页
Route::get('/page/{id}', [\App\Http\Controllers\V2\Index::class,'page'])->where('id','\d+');
Route::get('/page/{key}', [\App\Http\Controllers\V2\Index::class,'page'])->where('key','[a-z_\-\d]{2,}');
... ...