Home>
///index?r=site/index
echo url ::to (["site/index"]);
///index?r=site/index&src=ref1 #name
echo url ::to (["site/index", "src" =>"ref1", "#" =>"name"]);
//the currently requested url
echo url ::to ();
///images/logo.gif
echo url ::to ("@ web/images/logo.gif");
//images/logo.gif
echo url ::to ("images/logo.gif");
//http://www.example.com/images/logo.gif
echo url ::to ("@ web/images/logo.gif", true);
//https://www.example.com/images/logo.gif
echo url ::to ("@ web/images/logo.gif", "https");
///index?r=site/index
echo url ::toroute ("site/index");
///index?r=site/index&src=ref1 #name
echo url ::toroute (["site/index", "src" =>"ref1", "#" =>"name"]);
//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");
echo yii ::$app->urlmanager->createurl ("site/index")
php
  • Previous Example of simple switching menu with jQuery + CSS
  • Next Bootstrap zero-based entry tutorial (3)