本文整理汇总了PHP中Illuminate\Routing\Redirector::createRedirect方法的典型用法代码示例。如果您正苦于以下问题:PHP Redirector::createRedirect方法的具体用法?PHP Redirector::createRedirect怎么用?PHP Redirector::createRedirect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Routing\Redirector
的用法示例。
在下文中一共展示了Redirector::createRedirect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createRedirect
/**
* Create a new redirect response.
*
* @param string $path
* @param int $status
* @param array $headers
* @return \Illuminate\Http\RedirectResponse
*/
protected function createRedirect($path, $status, $headers)
{
$request = $this->generator->getRequest();
if ($request->ajax()) {
// for ajax requests, we don't want to return a typical 301 or 302 redirect since the ajax request
// will follow that and not actually redirect the browser, which is likely our intention
// we therefore return a json response via our AjaxRedirectResponse class
$redirect = new AjaxRedirectResponse($path, 278, $headers);
if (isset($this->session)) {
$redirect->setSession($this->session);
}
$redirect->setRequest($this->generator->getRequest());
return $redirect;
} else {
return parent::createRedirect($path, $status, $headers);
}
}