如何在重定向后添加 header 形成 url?
How to add a header to form url after redirected back?
如何将 header 添加到对此的回复中?
public function handleDonate($data, $form)
{
$donate = DonationForm::create();
$donate->FullName = $data['FullName'];
$donate->Amount = $data['Amount'];
$donate->Email = $data['Email'];
$donate->Message = $data['Message'];
$donate->SponsorshipPageID = $this->ID;
$donate->write();
return $this->redirectBack();
}
redirectBack()
return 是一个 HTTPResponse
对象,因此您可以在 return 之前对其进行操作:
return $this->redirectBack()->addHeader('X-Foo', 'Bar');
如何将 header 添加到对此的回复中?
public function handleDonate($data, $form)
{
$donate = DonationForm::create();
$donate->FullName = $data['FullName'];
$donate->Amount = $data['Amount'];
$donate->Email = $data['Email'];
$donate->Message = $data['Message'];
$donate->SponsorshipPageID = $this->ID;
$donate->write();
return $this->redirectBack();
}
redirectBack()
return 是一个 HTTPResponse
对象,因此您可以在 return 之前对其进行操作:
return $this->redirectBack()->addHeader('X-Foo', 'Bar');