PhalconPHP、volt和自定义函数:调用动态函数的方式

PhalconPHP, volt and custom function: way to call dynamic function

这是我的代码

/**
 * Setting up the view component
 */
     $di->setShared('view', function () use ($config) {

    $view = new View();

    $view->setViewsDir($config->application->viewsDir);

    $view->registerEngines(array(
        '.volt' => function ($view, $di) use ($config) {

            $volt = new VoltEngine($view, $di);

            $volt->setOptions(array(
                'compiledPath' => $config->application->cacheDir,
                'compiledSeparator' => '_'
            ));

            $volt->getCompiler()->addFunction(
                'paymentStatus',
                function($key)
                {
                    return @"Info::paymentStatus({$key})";
                }
            );

            return $volt;
        },
        '.phtml' => 'Phalcon\Mvc\View\Engine\Php'
    ));

    return $view;
});

以及错误信息(希望老实说)

Strict Standards: Non-static method Info::paymentStatus() should not be called statically, assuming $this from incompatible context in /home/zxcvbnm/public_html/app/cache/_home_zxcvbnm_public_html_app_views_invoice_admininvoice.volt.php on line 49

如何动态调用方法?

如果你想调用你的方法是静态的,你必须把方法实现改成静态的:

public static function paymentStatus($key){
     ...code
}