网友真实露脸自拍10p,成人国产精品秘?久久久按摩,国产精品久久久久久无码不卡,成人免费区一区二区三区

前置操作

可以為某個或者某些操作指定前置執行的操作方法,設置 beforeActionList屬性可以指定某個方法為其他方法的前置操作,數組鍵名為需要調用的前置方法名,無值的話為當前控制器下所有方法的前置方法。

['except' => '方法名,方法名']

表示這些方法不使用前置方法,

['only' => '方法名,方法名']

表示只有這些方法使用前置方法。

示例如下:

namespace app\index\controller;

use think\Controller;

class Index extends Controller
{
    protected $beforeActionList = [
        'first',
        'second' =>  ['except'=>'hello'],
        'three'  =>  ['only'=>'hello,data'],
    ];
    
    protected function first()
    {
        echo 'first<br/>';
    }
    
    protected function second()
    {
        echo 'second<br/>';
    }
    
    protected function three()
    {
        echo 'three<br/>';
    }

    public function hello()
    {
        return 'hello';
    }
    
    public function data()
    {
        return 'data';
    }
}

訪問

http://localhost/index.php/index/Index/hello

最后的輸出結果是

first
three
hello

訪問

http://localhost/index.php/index/Index/data

的輸出結果是:

first
second
three
data
文檔最后更新時間:2018-04-26 08:32:40

文檔
目錄

深色
模式

切換
寬度