0
如何將一個get變量傳遞給Laravel中的控制器?將參數傳遞給Laravel中的控制器
我:
$languages = array('zh');
$locale = Request::segment(1);
if (in_array($locale, $languages)) {
App::setLocale($locale);
} else {
$locale = null;
}
Route::group(array('prefix' => $locale), function() {
...
Route::get('/search/{q}', array('as' => 'search', 'uses' => '[email protected]'));
...
});
如果我嘗試使用Input::get('q');
我什麼也得不到控制器內返回q
。
請參閱本http://stackoverflow.com/questions/27012994/laravel-how-to-isset-get/27013133#27013133 – 2014-11-22 09:57:38
你可以試試這個代碼來讀取查詢字符串$位置值=請求:: query('q',false); – 2014-11-22 10:01:22