load_filter加载过滤器

优质
小牛编辑
124浏览
2023-12-01

void load_filter(string type, string name)

This function can be used to load a filter plugin. The first argument specifies the type of the filter to load and can be one of the following: 'pre', 'post', or 'output'. The second argument specifies the name of the filter plugin, for example, 'trim'.

这个函数用来加载过滤器插件。第一个参数指定过滤器的类型,只能是下列之一:“pre”,“post”,或者是“output”。第二个参数指定过 滤器插件的名称,比如“trim”。

Example 13-20. loading filter plugins
例子 13-20. 加载过滤器插件

$smarty->load_filter('pre', 'trim'); // load prefilter named 'trim'
$smarty->load_filter('pre', 'datefooter'); // load another prefilter named 'datefooter'
$smarty->load_filter('output', 'compress'); // load output filter named 'compress'