Laravel 5 getting ID from URL

前端 未结 7 1822
一整个雨季
一整个雨季 2020-12-31 08:22

I have a table view in which I can click an button icon and redirect to another page carrying the id of the row that has been clicked.

@foreach ($pa         


        
7条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-31 08:54

    Simple example:

    as link=>   example.com/user/1
    
    as rout=> Route::get('user/{id}', 'UserController@user');
    
    as UserController function 
    
    public function user($id){
    
        echo $id;
    
    }
    
    output => 1
    

提交回复
热议问题