生成相当于树枝文件的 HTML 模板?

Generate the HTML template equivalent of a twig file?(生成相当于树枝文件的 HTML 模板?)
本文介绍了生成相当于树枝文件的 HTML 模板?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否可以为每个 {filename}.html.twig 生成 {filename}.html?我知道一种解决方案是从浏览器复制和粘贴源代码,但有没有更有效的方法?

I'd like to know if it's possible to have {filename}.html generated for every {filename}.html.twig? I know one solution is to copy and paste the source code from the browser, but is there a more efficient way of doing this?

提前谢谢你.

推荐答案

我认为这样的解决方案将满足您的需求.

Such solution, I think, will satisfy your needs.

curl www.yoururl.com >/path/to/yourfolder/file.html

如果你有兴趣,请看下面的故事.

Have a look below story, if you interested in.

故事

几个月前,我在做一个 yii2 项目.由于外部服务的响应,索引页面在 3 秒内加载完毕.Cloudflare 和其他缓存方案没有成功 - 我想出了最好的 2.5 秒.

A few months ago, i was working on a yii2 project. The index page was loading in 3 seconds because of response from external services. Cloudflare and other caching scenarios weren't succeeded - I came up with 2.5 seconds best.

经过 2-3 天的思考期,我找到了一个令人讨厌的解决方案 :)创建了一个无缓存、新版本的主页并编写了一个 cron 作业,以获取该页面的内容并每 2 分钟写入公共(在 yii2 web 文件夹中)内的 index.html 文件.

After 2-3 days of thinking period, I found a nasty solution :) Created a cache-less, fresh version of homepage and wrote a crone job, to fetch the contents of that page and write into index.html file inside public (in yii2 web) folder in every 2 minutes.

其他页面还可以 - (<0.2s),所以没有为他们写任何东西.

Other pages were ok - (<0.2s), so didn't wrote anything for them.

我所做的只是

curl www.example.com >/path/to/web/index.html

这篇关于生成相当于树枝文件的 HTML 模板?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

how to remove this error quot;Response must contain an array at quot; . quot;.quot; while making dropdown(如何删除此错误quot;响应必须在quot;处包含数组。创建下拉菜单时(Q;))
Why is it necessary to use `document.createElementNS` when adding `svg` tags to an HTML document via JS?(为什么在通过JS为一个HTML文档添加`svg`标签时,需要使用`Document.createElementNS`?)
wkhtmltopdf print-media-type uses @media print ONLY and ignores the rest(Wkhtmltopdf print-media-type仅使用@media print,而忽略其余内容)
price depend on selection of radio input(价格取决于无线电输入的选择)
calculate price depend on selection without button(根据没有按钮的选择计算价格)
What should I consider before minifying HTML?(在缩小HTML之前,我应该考虑什么?)