Spec-Zone.ru › Symfony 2.7

HttpUtils

класс HttpUtils

Инкапсулирует логику, необходимую для создания дочерних запросов, перенаправления пользователя и сопоставления URL-адресов.

Методы

__construct(UrlGeneratorInterface $urlGenerator = null, UrlMatcherInterface|RequestMatcherInterface $urlMatcher = null)
RedirectResponse createRedirectResponse(Request $request, string $path, int $status = 302)

Создаёт ответ перенаправления.

Request createRequest(Request $request, string $path)

Создаёт запрос.

bool checkRequestPath(Request $request, string $path)

Проверяет, соответствует ли заданный путь запросу.

string generateUri(Request $request, string $path)

Генерирует URI на основе заданного пути или абсолютного URL-адреса.

Подробности

__construct(UrlGeneratorInterface $urlGenerator = null, UrlMatcherInterface|RequestMatcherInterface $urlMatcher = null)

Параметры

UrlGeneratorInterface $urlGenerator Экземпляр UrlGeneratorInterface
UrlMatcherInterface|RequestMatcherInterface $urlMatcher Сопоставитель URL или запроса

Исключения

InvalidArgumentException

RedirectResponse createRedirectResponse(Request $request, string $path, int $status = 302)

Создаёт ответ перенаправления.

Параметры

Request $request Экземпляр Request
string $path Путь (абсолютный путь (/foo), абсолютный URL (http://...), или имя маршрута (foo))
int $status Код состояния

Возвращаемое значение

RedirectResponse Экземпляр RedirectResponse

Request createRequest(Request $request, string $path)

Создаёт запрос.

Параметры

Request $request Текущий экземпляр Request
string $path Путь (абсолютный путь (/foo), абсолютный URL (http://...), или имя маршрута (foo))

Возвращаемое значение

Request Экземпляр Request

bool checkRequestPath(Request $request, string $path)

Проверяет, соответствует ли заданный путь запросу.

Параметры

Request $request Экземпляр Request
string $path Путь (абсолютный путь (/foo), абсолютный URL (http://...), или имя маршрута (foo))

Возвращаемое значение

bool true, если путь совпадает с путём из запроса, иначе false

string generateUri(Request $request, string $path)

Генерирует URI на основе заданного пути или абсолютного URL-адреса.

Параметры

Request $request Экземпляр Request
string $path Путь (абсолютный путь (/foo), абсолютный URL (http://...), или имя маршрута (foo))

Возвращаемое значение

string Абсолютный URL

Исключения

LogicException

© 2004–2017 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/2.7/Symfony/Component/Security/Http/HttpUtils.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API