Yii的Url::toRoute
生活随笔
收集整理的這篇文章主要介紹了
Yii的Url::toRoute
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
沒有參數直接用單引號字符串;有參數 ?用一個數組表示 ?第一個元素是地址 ?第二個元素是參數
use yii\helpers\Url; // /index.php?r=site/index echo Url::toRoute('site/index');// /index.php?r=site/index&src=ref1#name echo Url::toRoute(['site/index', 'src' => 'ref1', '#' => 'name']);// /index.php?r=post/edit&id=100 假設別名 "@postEdit" 被定義為 "post/edit" echo Url::toRoute(['@postEdit', 'id' => 100]);// http://www.example.com/index.php?r=site/index echo Url::toRoute('site/index', true);// https://www.example.com/index.php?r=site/index echo Url::toRoute('site/index', 'https');?
總結
以上是生活随笔為你收集整理的Yii的Url::toRoute的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: PHP的查找stripos strpos
- 下一篇: 为什么五菱宏光迷你 不能装快充,为什么奇