如何添加 actions

<?php
namespace app\Actions;

use yii\base\Action;

class GzhAppFormatOutput extends Action
{
    public $objectsToFormat;
public $id;
public function run() {
    return "Hello world!"; } }

 在调用时:

    public function actions()
    {
        return [
            'about' => [
                'class' => 'app\actions\GzhAppFormatOutput',//此处要注意actions一定是GzhAppFormatOutput.php所在的文件夹

                'objectsToFormat' => 'abc',

                'id' => '123',],];
    }

 

posted @ 2015-07-20 21:14  S大好人S  阅读(236)  评论(0编辑  收藏  举报