我為(我確定)一個小失蹤而浪費了太多時間,但我找不到它。這是我的問題。我想創建一個開放的刀片,因此無需身份驗證,URL 中有一個可變參數。這是我的代碼// routes/web.php Route::get('/{org_id}/tickets/ext/index', array('as' => 'tickets.ext.index', 'uses' => 'Ext\ExtTicketsController@index'));// Ext\ExtTicketsController public function index(Request $request, $org_id) { //$org_id = 'my_organization'; //dd(app()->getLocale()); $locale=substr($request->server('HTTP_ACCEPT_LANGUAGE'), 0, 2); return view('tickets/ext/index') ->with('org_id',$org_id) ->with('locale',$locale); }當我嘗試登陸http://localhost/app/public/en/ my_organization /tickets/ext/index 時出現錯誤,我不明白其來源:Missing required parameters for [Route: tickets.ext.index] [URI: {locale}/{org_id}/tickets/ext/index]我將刀片插入 views/ticket/ext/index 文件。
1 回答

躍然一笑
TA貢獻1826條經驗 獲得超6個贊
你可以像這樣簡化你的代碼,我希望它能工作
// routes/web.php
Route::get('/{org_id}/tickets/ext/index', 'Ext\ExtTicketsController@index');
// Ext\ExtTicketsController
public function index($org_id)
{
$org_id = $org_id';
$locale=substr($request->server('HTTP_ACCEPT_LANGUAGE'), 0, 2);
return view('tickets.ext.index',compact('org_id','locale'));
}
- 1 回答
- 0 關注
- 115 瀏覽
添加回答
舉報
0/150
提交
取消