>[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' => [
// ...
],
],
],
]
~~~