0
如何在php artisan make:request Foo
中獲取請求標頭?在驗證授權功能中獲取請求值
public function authorize()
{
dd($this->request->header('value'));
return ...
}
我發送一個HEAD請求,我需要它的authorize()
內在價值。可能?
如何在php artisan make:request Foo
中獲取請求標頭?在驗證授權功能中獲取請求值
public function authorize()
{
dd($this->request->header('value'));
return ...
}
我發送一個HEAD請求,我需要它的authorize()
內在價值。可能?
您可以使用該功能檢索Request
對象。
request()->header('value');
FormRequest只不過是Request的擴展。所以你可以做到這一點
$this->header('value')
你知道我已經花了3小時在這! Bruh ...謝謝! – Sylar