【发布时间】:2015-11-20 12:47:37
【问题描述】:
我尝试使用 steamid 作为我的路线,所以它将是 www.example.com./profile/76561198050605019
我现在的代码是:
Route::get('{steamid}', function($steamid){
$user = App\user::find($steamid);
echo 'hello my steam name is ' . $user->username . '<br />';
echo 'hello my steam ID64 is ' . $user->steamid . '<br />';
});
我有这个,应该可以,但不是。 我已经尝试过了,它可以工作:
Route::get('{steamid}', function($id){
$user = App\user::find($id);
echo 'hello my steam name is ' . $user->username . '<br />';
});
使用 www.example.com/profile/3 的网址
编辑::
我已经解决了我自己的问题
$user = User::where('steamid', $steamid)->firstOrFail();
我需要使用那条线。
【问题讨论】:
-
什么不工作,什么错误?
-
嗯,错误是带有蒸汽 id 的 url 不起作用。但我现在知道为什么它不起作用并且我已经修复了它
-
您能否也发布您的解决方案作为答案并接受它,以便其他人可以清楚地看到解决方案是什么?
-
是的,对不起,我是堆栈新手
标签: php laravel steam steam-web-api steamworks-api