yii\web\UrlRuleInterface - Yii2 类参考手册

Interface yii\web\UrlRuleInterface

Implemented byyii\rest\UrlRule, yii\web\CompositeUrlRule, yii\web\GroupUrlRule, yii\web\UrlRule
Available since version2.0

UrlRuleInterface is the interface that should be implemented by URL rule classes.

Public Methods

隐藏继承的方法 Hide inherited methods

方法 Method简介 Description定义在 Defined By
createUrl() Creates a URL according to the given route and parameters. yii\web\UrlRuleInterface
parseRequest() Parses the given request and returns the corresponding route and parameters. yii\web\UrlRuleInterface

方法详情 Method Details

createUrl() public abstract method

Creates a URL according to the given route and parameters.

public abstract string|boolean createUrl ( $manager, $route, $params )
$manager yii\web\UrlManager

The URL manager

$route string

The route. It should not have slashes at the beginning or the end.

$params array

The parameters

return string|boolean

The created URL, or false if this rule cannot be used for creating this URL.

parseRequest() public abstract method

Parses the given request and returns the corresponding route and parameters.

public abstract array|boolean parseRequest ( $manager, $request )
$manager yii\web\UrlManager

The URL manager

$request yii\web\Request

The request component

return 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.