mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-15 22:09:48 +08:00
53 lines
956 B
PHP
53 lines
956 B
PHP
<?php
|
|
/**
|
|
* UrlManager class file
|
|
*
|
|
* @link http://www.yiiframework.com/
|
|
* @copyright Copyright © 2008 Yii Software LLC
|
|
* @license http://www.yiiframework.com/license/
|
|
*/
|
|
|
|
namespace yii\web;
|
|
|
|
use \yii\base\Component;
|
|
|
|
/**
|
|
* UrlManager manages the URLs of Yii applications.
|
|
*
|
|
* @author Qiang Xue <qiang.xue@gmail.com>
|
|
* @since 2.0
|
|
*/
|
|
class UrlManager extends Component
|
|
{
|
|
public $routeVar = 'r';
|
|
|
|
/**
|
|
* Initializes the application component.
|
|
*/
|
|
public function init()
|
|
{
|
|
parent::init();
|
|
$this->processRules();
|
|
}
|
|
|
|
/**
|
|
* Processes the URL rules.
|
|
*/
|
|
protected function processRules()
|
|
{
|
|
}
|
|
|
|
/**
|
|
* Parses the user request.
|
|
* @param HttpRequest $request the request application component
|
|
* @return string the route (controllerID/actionID) and perhaps GET parameters in path format.
|
|
*/
|
|
public function parseUrl($request)
|
|
{
|
|
if(isset($_GET[$this->routeVar]))
|
|
return $_GET[$this->routeVar];
|
|
else
|
|
return '';
|
|
}
|
|
}
|