Route::resource('/topic', app\controller\TopicController::class);
我如何拿到这个1
$request->get('id');这样写不行,
只能 $request->uri('id'),自己来截取字符串吗?
Route::resource('/topic/{id}', app\controller\TopicController::class);
这样写会报错
FastRoute\BadRouteException: Cannot use the same placeholder "id" twice in /home/meng/work/graduate/vendor/nikic/fast-route/src/DataGenerator/RegexBasedAbstract.php:139
Stack trace:
方法里面这样写就可以了
public function destroy(Request $request,$id): \support\Response
{
//$id = $request->input('id');
return Response::success($id);
}