后置(cp_after)


在控制器被调用之后执行

使用方法

namespace app\web\controllers;

use Cross\Core\Delegate;

class Main extends Web
{
    /**
     * 默认控制器
     * @cp_after $self->indexAfter()
     */
    function index()
    {
        $this->data ['action'] = __FUNCTION__;
        $this->data ['version'] = Delegate::getVersion();

        $this->display($this->data);
    }

    function indexAfter()
    {
        echo 'after';
    }
}

在注释中增加

@cp_after $self->indexAfter()

参数中用$self代替$this指定要调用的方法, 该方法会在index()方法之后被调用