我為(我確定)一個(gè)小失蹤而浪費(fèi)了太多時(shí)間,但我找不到它。這是我的問題。我想創(chuàng)建一個(gè)開放的刀片,因此無需身份驗(yàn)證,URL 中有一個(gè)可變參數(shù)。這是我的代碼// 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); }當(dāng)我嘗試登陸http://localhost/app/public/en/ my_organization /tickets/ext/index 時(shí)出現(xiàn)錯(cuò)誤,我不明白其來源:Missing required parameters for [Route: tickets.ext.index] [URI: {locale}/{org_id}/tickets/ext/index]我將刀片插入 views/ticket/ext/index 文件。
1 回答

躍然一笑
TA貢獻(xiàn)1826條經(jīng)驗(yàn) 獲得超6個(gè)贊
你可以像這樣簡(jiǎn)化你的代碼,我希望它能工作
// 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 關(guān)注
- 142 瀏覽
添加回答
舉報(bào)
0/150
提交
取消