Php 未加载Assetic CSS背景图像,但具有相同的文件路径
我知道这已经被问了好几次,但我仍然有困难让我的CSS背景图像与assetic的工作 我已阅读,所有背景图像在我的CSS中都设置为../images:Php 未加载Assetic CSS背景图像,但具有相同的文件路径,php,css,symfony,assetic,Php,Css,Symfony,Assetic,我知道这已经被问了好几次,但我仍然有困难让我的CSS背景图像与assetic的工作 我已阅读,所有背景图像在我的CSS中都设置为../images: background:url(../images/icons/icon.png) 并在我的小树枝文件中显示为: {% stylesheets 'bundles/commondirty/css_original/c.css' filter="cssrewrite" %} <link href="{{ asset_url }}" rel=
background:url(../images/icons/icon.png)
并在我的小树枝文件中显示为:
{% stylesheets 'bundles/commondirty/css_original/c.css' filter="cssrewrite" %}
<link href="{{ asset_url }}" rel="stylesheet" type="text/css" />
{% endstylesheets %}
然后,如上述答案所述:
php app/console --env=prod assets:install web
php app/console assetic:dump --env=prod
这可以在本地工作(“app.php”、“app_dev.php”和“/”),但一旦我将文件上载到生产环境,它就无法加载背景图像
本地和生产CSS如下所示,所以我不明白为什么它不工作
url(“../../bundles/main/images/icons/lrg\u coin.png”)
权限?我需要重新加载/清除某些内容吗
编辑
dev和prod上的缓存CSS文件指向:
url(../../bundles/main/images/icons/lrg\u coin.png)
当我猜它需要是。/
而不是。/../../
?这怎么能改变呢?好吧,我想我做错了什么,所以我想我会发布文章供将来参考。我在prod_config.yml中将use_controller设置为false,它覆盖了我的config.yml设置(dev_config.yml使用)
将此更改为true,并按照我的问题中的说明清除/重新加载所有内容,从而解决了问题。我知道这很简单 谢谢,它解决了我的问题,但我不太明白它到底是做什么的
php app/console --env=prod assets:install web
php app/console assetic:dump --env=prod
assetic:
use_controller: false