包括来自树枝的非树枝文件 [英] Including a non-twig file from twig

查看:20
本文介绍了包括来自树枝的非树枝文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在 Twig 模板中包含一个文件的内容(在我的资源文件夹中).

I need to include the contents of a file (inside my resources folder) inside a Twig template.

我试过这个没有运气:

{% include 'public/directory/file.ext' %}

Twig 不能做到这一点吗?(我不想用 Assetic)

Isn't Twig capable of this? (I don't want to use Assetic)

推荐答案

我做了一个 bundle 刚刚为此前段时间.它几乎是 file_get_contents 的包装器.

I made a bundle just for this some time ago. It's pretty much a wrapper for file_get_contents.

可以在这里.

这篇关于包括来自树枝的非树枝文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆