2017-10-14 69 views
1
$api->version('v1', ['middleware' => 'api.auth'], function($api){ 
    $api->get('auth/user', 'App\Http\Controllers\Api\[email protected]'); 

    $api->get('auth/getInfo', 'App\Http\Controllers\Api\[email protected]'); 

    $api->get('auth/show/{id}', 'App\Http\Controllers\Api\[email protected]'); 

}); 

public function show($id) 
    { 
    echo $id;die; 
} 

Error 

    "message": "404 Not Found", 
    "status_code": 404, 
    "debug": { 
     "line": 161, 
     "file": "C:\\xampp\\htdocs\\G2Project\\medcrip\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\RouteCollection.php", 

我在get方法中添加參數時卡住不知道爲什麼這是說找不到。如果我從路由中刪除{id},它可以正常工作,但是當我添加{id}時對我說沒有找到。提前丁當錯誤,同時得到方法與參數

請指點謝謝

+0

得到,當你使用的是什麼URI是錯誤? –

+0

http:// localhost:8000/api/auth/show /?id = 53 – Amy

回答

2

爲了使auth/show/{id}路線的工作,你應該使用這個URI:

/api/auth/show/53 

,而不是這樣的:

/api/auth/show/?id=53 
+0

Ohh damm。我非常抱歉,完全愚蠢。謝謝alexey .. – Amy

+0

很高興幫助。 –

相關問題