Smarty成員方法:registerFilter()

2018-12-02 15:49 更新

Name

registerFilter() — 注冊過濾器

說明

void registerFilter(string type,
                    mixed callback);

注冊過濾器。 參數(shù)如下:

  • type defines the type of the filter. Valid values are "pre", "post", "output" and "variable".

  • callback defines the PHP callback. it can be either:

    • A string containing the function name

    • An array of the form array(&$object, $method) with &$object being a reference to an object and $method being a string containing the method-name

    • An array of the form array($class, $method) with $class being the class name and $method being a method of the class.

Technical Note

If the chosen function callback is of the form array(&$object, $method), only one instance of the same class and with the same$method can be registered. The latest registered function callback will be used in such a scenario.

prefilter前置過濾器,在模板編譯之前執(zhí)行的過濾器。 詳情參見前置過濾器。

postfilter后置過濾器,在模板編譯成PHP后執(zhí)行的過濾器。 詳情參見后置過濾器。

outputfilter輸出過濾器,在模板將要displayed前執(zhí)行的過濾器。 詳情參見輸出過濾器。

參見 unregisterFilter()loadFilter()$autoload_filters, 前置過濾器 后置過濾器輸出過濾器。

以上內(nèi)容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號