88

flask中jinjia2模板引擎使用详解5-挨踢学霸

 6 years ago
source link: http://blog.51cto.com/12482328/2083998
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
接上文宏可以理解为函数,即把一些常用的模板片段做好封装,以便于重用,减少工作量和维护难度。宏的定义很简单:{%macro xxx()%}##这里写内容{%endmacro%}下面引用官方的一个例子进行说明:{% macro input(name, value='', type='text', size=20) -%}<input type="{{ type }}" name="{{ name

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK