getAssetUrl() публичный Метод

The actual URL is obtained by prepending either [[AssetBundle::$baseUrl]] or [[AssetManager::$baseUrl]] to the given asset path.
public getAssetUrl ( AssetBundle $bundle, string $asset ) : string
$bundle AssetBundle the asset bundle which the asset file belongs to
$asset string the asset path. This should be one of the assets listed in [[AssetBundle::$js]] or [[AssetBundle::$css]].
Результат string the actual URL for the specified asset.
Пример #1
0
 public function getAssetUrl($bundle, $asset)
 {
     $url = parent::getAssetUrl($bundle, $asset);
     $absPath = \Yii::getAlias('@webroot') . $url;
     if (is_file($absPath)) {
         $mtime = filemtime($absPath);
         $md = md5($mtime);
         $v = substr($md, 0, 8);
         $url .= StringHelper::contains($url, '?') ? '&' : '?';
         $url .= "v={$v}";
     }
     return $url;
 }