コード例 #1
0
ファイル: UrlRoute.php プロジェクト: jivoo/http
 /**
  * {@inheritdoc}
  */
 public function dispatch(\Jivoo\Http\ActionRequest $request, \Psr\Http\Message\ResponseInterface $response)
 {
     return \Jivoo\Http\Message\Response::redirect($this->getUrl());
 }
コード例 #2
0
ファイル: Router.php プロジェクト: jivoo/http
 /**
  * Create a path redirect.
  *
  * @param string|string[] $path Path array.
  * @param array $query Query.
  * @param string $fragment Fragment.
  * @param bool $permanent Whether redirect is permanent.
  * @param bool $rewrite Whether to force removal of script name from path.
  * @return ResponseInterface A redirect response.
  */
 public function redirectPath($path, array $query = [], $fragment = '', $permanent = false, $rewrite = false)
 {
     $location = new Message\Uri($this->request->pathToString($path, $rewrite));
     $location = $location->withQuery(http_build_query($query))->withFragment($fragment);
     return Message\Response::redirect($location, $permanent);
 }