Свойство | Type | Description | |
---|---|---|---|
$defaults | the default GET parameters (name => value) that this rule provides. When this rule is used to parse the incoming request, the values declared in this property will be injected into $_GET. | ||
$encodeParams | a value indicating if parameters should be url encoded. | ||
$host | the pattern used to parse and create the host info part of a URL (e.g. http://example.com). | ||
$mode | a value indicating if this rule should be used for both request parsing and URL creation, parsing only, or creation only. If not set or 0, it means the rule is both request parsing and URL creation. If it is [[PARSING_ONLY]], the rule is for request parsing only. If it is [[CREATION_ONLY]], the rule is for URL creation only. | ||
$name | the name of this rule. If not set, it will use [[pattern]] as the name. | ||
$normalizer | the configuration for UrlNormalizer used by this rule. If null, [[UrlManager::normalizer]] will be used, if false, normalization will be skipped for this rule. | ||
$pattern | On the rule initialization, the [[pattern]] matching parameters names will be replaced with [[placeholders]]. | ||
$route | the route to the controller action | ||
$suffix | the URL suffix used for this rule. For example, ".html" can be used so that the URL looks like pointing to a static HTML page. If not, the value of [[UrlManager::suffix]] will be used. | ||
$verb | the HTTP verb (e.g. GET, POST, DELETE) that this rule should match. Use array to represent multiple verbs that this rule may match. If this property is not set, the rule can match any verb. Note that this property is only used when parsing a request. It is ignored for URL creation. |
Свойство | Type | Description | |
---|---|---|---|
$placeholders | list of placeholders for matching parameters names. Used in UrlRule::parseRequest, UrlRule::createUrl. On the rule initialization, the [[pattern]] parameters names will be replaced with placeholders. This array contains relations between the original parameters names and their placeholders. The array keys are the placeholders and the values are the original names. |
Méthode | Description | |
---|---|---|
createUrl ( |
Creates a URL according to the given route and parameters. | |
init ( ) | Initializes this rule. | |
parseRequest ( |
Parses the given request and returns the corresponding route and parameters. |
Méthode | Description | |
---|---|---|
getNormalizer ( |
||
getParamRules ( ) : array | Returns list of regex for matching parameter. | |
hasNormalizer ( |
||
substitutePlaceholderNames ( array $matches ) : array | Iterates over [[placeholders]] and checks whether each placeholder exists as a key in $matches array. |
public createUrl ( |
||
$manager | the URL manager | |
$route | string | the route. It should not have slashes at the beginning or the end. |
$params | array | the parameters |
Résultat | string | boolean | the created URL, or `false` if this rule cannot be used for creating this URL. |
protected getNormalizer ( |
||
$manager | the URL manager | |
Résultat |
protected getParamRules ( ) : array | ||
Résultat | array | parameter keys and regexp rules. |
protected hasNormalizer ( |
||
$manager | the URL manager | |
Résultat | boolean |
public parseRequest ( |
||
$manager | the URL manager | |
$request | the request component | |
Résultat | array | boolean | the parsing result. The route and the parameters are returned as an array. If `false`, it means this rule cannot be used to parse this path info. |
protected substitutePlaceholderNames ( array $matches ) : array | ||
$matches | array | result of `preg_match()` call |
Résultat | array | input array with replaced placeholder keys |
public $defaults |
public $encodeParams |
public $host |
public $mode |
public $name |
public $normalizer |
public $pattern |
protected $placeholders |
public $suffix |
public $verb |