我從URL獲取GET參數時遇到問題。Laravel 5.1 GET url參數鍵不正確傳遞給控制器
如果我有e.g
http://domain.tld/route?page=2
,比控制器I DD數據從
dd(Input::all());
Laravel換來的是
array:1 [▼
"//route?page" => "2"
]
但應該
array:1 [▼
"page" => "2"
]
5.0上的Laravel 5.1存在問題,一切正常。
途徑代碼是
Route::get('/klub', ['as' => 'teamInfo', 'uses' => 'Game\Team\[email protected]']);
位指示代碼
final public function index(Request $request)
{
$userTeam = UserCache::get('team');
if ($userTeam->id > 0)
return view('game.team.info')->with(['userTeam' => $userTeam]);
else {
//this is executing in my case
$proposals = Teams::proposals()->paginate(1);
return view('game.team.empty', ['teamLimits' => conf('team.php'), 'userTeam' => $userTeam, 'proposals' => $proposals]);
}
}
var_dump($_SERVER['QUERY_STRING']);
string(13) "//klub?page=2"
var_dump($_SERVER['REQUEST_URI']);
string(12) "/klub?page=2"
任何理由不使用Request對象? '$請求 - >輸入( '頁')'? – Pitchinnate
@Pitchinnate它返回相同 – rafwlaz
需要看到更多的代碼,然後,像你的路由器和功能的控制器可能的幫助。 – Pitchinnate