mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-16 23:48:16 +08:00
Update runtime-routing.md
This commit is contained in:
@ -578,19 +578,11 @@ We can create the following URL rule class to solve this problem.
|
|||||||
```php
|
```php
|
||||||
namespace app\components;
|
namespace app\components;
|
||||||
|
|
||||||
use yii\web\UrlRule;
|
use yii\web\UrlRuleInterface;
|
||||||
|
use yii\base\Object;
|
||||||
|
|
||||||
class CarUrlRule extends UrlRule
|
class CarUrlRule extends Object implements UrlRuleInterface
|
||||||
{
|
{
|
||||||
public $db = 'db';
|
|
||||||
|
|
||||||
public function init()
|
|
||||||
{
|
|
||||||
parent::init();
|
|
||||||
if ($this->name === null) {
|
|
||||||
$this->name = __CLASS__;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function createUrl($manager, $route, $params)
|
public function createUrl($manager, $route, $params)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user