PHP 클래스 yii\web\UrlNormalizer

부터: 2.0.10
저자: Robert Korulczyk ([email protected])
저자: Cronfy ([email protected])
상속: extends yii\base\Object
파일 보기 프로젝트 열기: yiisoft/yii2 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$action action to perform during route normalization. Available options are: - null - no special action will be performed - 301 - the request should be redirected to the normalized URL using permanent redirection - 302 - the request should be redirected to the normalized URL using temporary redirection - 404 - NotFoundHttpException will be thrown - callable - custom user callback, for example: php function ($route, $normalizer) { use custom action for redirections $route[1]['oldRoute'] = $route[0]; $route[0] = 'site/redirect'; return $route; }
$collapseSlashes whether slashes should be collapsed, for example site///index will be converted into site/index
$normalizeTrailingSlash whether trailing slash should be normalized according to the suffix settings of the rule

공개 메소드들

메소드 설명
normalizePathInfo ( string $pathInfo, string $suffix, boolean &$normalized = false ) : string Normalizes specified pathInfo.
normalizeRoute ( array $route ) : array Performs normalization action for the specified $route.

보호된 메소드들

메소드 설명
collapseSlashes ( string $pathInfo ) : string Collapse consecutive slashes in $pathInfo, for example converts site///index into site/index.
normalizeTrailingSlash ( string $pathInfo, string $suffix ) : string Adds or removes trailing slashes from $pathInfo depending on whether the $suffix has a trailing slash or not.

메소드 상세

collapseSlashes() 보호된 메소드

Collapse consecutive slashes in $pathInfo, for example converts site///index into site/index.
protected collapseSlashes ( string $pathInfo ) : string
$pathInfo string raw path info.
리턴 string normalized path info.

normalizePathInfo() 공개 메소드

Normalizes specified pathInfo.
public normalizePathInfo ( string $pathInfo, string $suffix, boolean &$normalized = false ) : string
$pathInfo string pathInfo for normalization
$suffix string current rule suffix
$normalized boolean if specified, this variable will be set to `true` if $pathInfo was changed during normalization
리턴 string normalized pathInfo

normalizeRoute() 공개 메소드

Performs normalization action for the specified $route.
public normalizeRoute ( array $route ) : array
$route array route for normalization
리턴 array normalized route

normalizeTrailingSlash() 보호된 메소드

Adds or removes trailing slashes from $pathInfo depending on whether the $suffix has a trailing slash or not.
protected normalizeTrailingSlash ( string $pathInfo, string $suffix ) : string
$pathInfo string raw path info.
$suffix string
리턴 string normalized path info.

프로퍼티 상세

$action 공개적으로 프로퍼티

action to perform during route normalization. Available options are: - null - no special action will be performed - 301 - the request should be redirected to the normalized URL using permanent redirection - 302 - the request should be redirected to the normalized URL using temporary redirection - 404 - NotFoundHttpException will be thrown - callable - custom user callback, for example: php function ($route, $normalizer) { use custom action for redirections $route[1]['oldRoute'] = $route[0]; $route[0] = 'site/redirect'; return $route; }
public $action

$collapseSlashes 공개적으로 프로퍼티

whether slashes should be collapsed, for example site///index will be converted into site/index
public $collapseSlashes

$normalizeTrailingSlash 공개적으로 프로퍼티

whether trailing slash should be normalized according to the suffix settings of the rule
public $normalizeTrailingSlash