Home > Backend Development > PHP Tutorial > symfony输出js和css文件,求大神指导为什么会报错了?

symfony输出js和css文件,求大神指导为什么会报错了?

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 20:19:37
Original
1158 people have browsed it

symfony输出js和css文件,求大神指导为什么会报错了?

symfony输出js和css文件,求大神指导为什么会报错了?

求指导!!!

回复内容:

symfony输出js和css文件,求大神指导为什么会报错了?

symfony输出js和css文件,求大神指导为什么会报错了?

求指导!!!

使用"javascripts"和"stylesheets"需要提前用Composer安装一个Symfony的官方Bundle,叫做Assetic(2.8版本以后,默认框架没有安装该Bundle,需要自行安装):

<code>$ composer require symfony/assetic-bundle</code>
Copy after login

然后,在AppKernel.php中启用该Bundle:

<code>// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    // ...

    public function registerBundles()
    {
        $bundles = array(
            // ...
            new Symfony\Bundle\AsseticBundle\AsseticBundle(),
        );

        // ...
    }
}</code>
Copy after login

最后,进行一些必要的配置:

<code># app/config/config.yml
assetic:
    debug:          '%kernel.debug%'
    use_controller: '%kernel.debug%'
    filters:
        cssrewrite: ~

# ...
</code>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template