>[info] 请参考 http://www.yiiframework.com/doc-2.0/guide-runtime-routing.html
### 路由的原理
默认路由 site/index
### 创建URL
~~~ php
use yii\helpers\Url;
echo Url::to(['post/index']);
echo Url::to(['post/view', 'id' => 100]);
~~~
### URL静态化
frontend\config\main.php
~~~
[
'components' => [
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'enableStrictParsing' => false,
'rules' => [
// ...
],
],
],
]
~~~