解析字符串而不是文件以获取Laravel Blade模板 [英] Parse a string instead of a file for a Laravel Blade template
问题描述
我需要缓存CMS生成的远程刀片模板,以使应用程序的公共接口保持最新状态.理想情况下,我每周可以使用file_get_contents和缓存来检查一次更新.有没有办法让Laravel使用变量的内容而不是文件作为刀片模板?
I need to cache a remote blade template generated by a CMS to keep an application's public interface up to date. Ideally I would be able to use file_get_contents and a cache to check for updates to this once a week. Is there any way to get Laravel to use the contents of a variable instead of a file as a blade template?
推荐答案
我找不到让laravel将字符串解析为刀片模板的方法,因此我开发了将远程模板存储为本地文件的方法. RemoteViewFinder Gist
I could not find a way to get laravel to parse a string as a blade template so I developed this work around that stores the remote template as a local file. RemoteViewFinder Gist
这篇关于解析字符串而不是文件以获取Laravel Blade模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!