【发布时间】:2017-07-02 01:58:07
【问题描述】:
我正在使用 knp-snappy-bundle 从树枝中生成 PDF。
但是我的 css 文件没有加载。
我用static url、absolute url 和只有asset url 进行了尝试,注意到工作正常,但这些是正常的css files,例如在我的编辑表单中显示时我也会使用它。这是我在pdf.html.twig 文件中尝试的三个选项
// STATIC DOES NOT WORK
<link rel="stylesheet" href="https://localhost/test/boot.css">
// ASSET DOES NOT WORK
<link rel="stylesheet" href="{{ asset('test/boot.css') }}">
// ABSOLUTE DOES NOT WORK
<link rel="stylesheet" href="{{ absolute_url(asset('test/boot.css')) }}">
总是得到这个:Warning: Failed to load https://localhost/test/boot.css (ignore)
【问题讨论】:
-
您是否在与 80/443 不同的端口上运行带有 PHP 内置服务器的 Symfony?
-
不,我使用的是 80/443
-
尝试使用绝对网址。示例:{{ absolute_url(asset('css/bootstrap.css')) }}
标签: php css symfony symfony-2.3 symfony-3.1