【问题标题】:Is it possible to pass data to a css file?是否可以将数据传递给css文件?
【发布时间】:2017-04-12 09:36:34
【问题描述】:

我正在用 php 编写 CMS 并想知道是否可以将 url 传递给图像,我的 php 页面使用 Twig 模板进行编码,并且我正在使用 {{ image1url }} 来回显图像 url,但是是否可以将该网址传递给css文件?像下面这样...

<link rel="stylesheet" href="{{ config['website']['web_address'] }}/themes/{{ config['template']['theme'] }}/{{ config['template']['css_folder'] }}/all.css?image_url={{ config['website']['image_url'] }}" type="text/css"/>

【问题讨论】:

    标签: php html css symfony


    【解决方案1】:

    是的,这是可能的,你必须确保 php 解析 css 扩展。我认为它在apache配置中。 (或您正在使用的任何服务器软件)

    另一种解决方案可能是使用内联 css,它将由 php 解析器解析。

    【讨论】:

      猜你喜欢
      • 2014-07-12
      • 2020-10-11
      • 1970-01-01
      • 2021-11-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-08-23
      相关资源
      最近更新 更多