2013-12-11 73 views

回答

0

我想你的代碼是在app/config/config/yml

看,這個代碼是在我的控制器:

use Symfony\Component\Yaml\Yaml; 
[...] 

$configfile = Yaml::parse($this->get('kernel')->getRootDir().'/config/config.yml'); 
baseurls = $configfile['framework']['templating']['packages']['assets']['base_urls']); 
-2

就不得不提到BASE_URL到參數部分 像

參數:
base_urls:http://assets.acme.com

然後藉助容器對象可以訪問任何服務或類。

像Controllar使用

$這 - >容器 - >的getParameter( 'base_urls');

+0

的問題是關於在模板>>資產訪問參數。 – vishal

0

一般:

$assetUrl = $this->container->get('templating.helper.assets')->getUrl($path, $packageName); 

你的情況:

$baseUrl = $this->container->get('templating.helper.assets')->getUrl('', 'assets'); 
相關問題