早上好。
我的页面中有加载css和js的问题。
我有Apache2,php5.4.12,win 7x64
我的来源:
<link rel="stylesheet" href="{{ asset('bundles/cleverfinancemain/style/main.css') }}" />
如果路由localhost / web / app.php =&gt;页面有
<link rel="stylesheet" href="/web/web/bundles/cleverfinancemain/style/main.css" />
如果路由localhost / web / app_dev.php =&gt;页面有
<link rel="stylesheet" href="/web/bundles/cleverfinancemain/style/main.css" />
为什么?
答案 0 :(得分:1)
您应该为生产环境运行php app/console assetic:dump --env=prod --no-debug
以生成资产文件。
此外,请考虑将web/
文件夹用作DocumentRoot。在这种情况下,您的应用程序将是localhost/app.php
(这应该是这样)
答案 1 :(得分:0)
删除缓存并检查一次。