国产+高潮+在线,国产 av 仑乱内谢,www国产亚洲精品久久,51国产偷自视频区视频,成人午夜精品网站在线观看

use 跨應(yīng)用插件 我怎么拿不到request->plugin 數(shù)據(jù),怎么才能實(shí)現(xiàn)拿到?

kspade

我自己建立了一個(gè)應(yīng)用插件:took,我想在\app\api\controller\index.php 中拿到took的數(shù)據(jù)

應(yīng)用插件Config.php代碼:

<?php
namespace plugin\took\app\controller;
use support\Request;
class Config{ 
    protected $plugin = null;
    public function __construct(){ 
        $this->request = Request(); 
        $this->plugin = $this->request->plugin;  //獲取當(dāng)前插件名稱
        $this->bot = $this->request->get("bot","null"); //這里是獲取的get參數(shù)
        if($this->bot == 'null'){
            return "獲取get參數(shù)bot 失敗"; 
        }
    }

    protected function send($msg){  
        return $this->plugin; 
    }
}

應(yīng)用插件base.php 代碼 繼承Config.php

<?php
namespace plugin\took\app\controller;

use support\Request;
use support\Response;

class Base extends Config{ 

    public function plugin(){   
        return $this->plugin;
    }

}

重點(diǎn)來了 我這時(shí)候想在 其它應(yīng)用插件里面或者隊(duì)列,定時(shí)任務(wù)等文件里面調(diào)用base.php 的 public function plugin() 方法

示例代碼:


$Base  =  new \plugin\took\app\controller\Base;
$plugin = $Base->plugin();  

這時(shí)候根本拿不到 plugin 名,還有什么其它辦法拿到 plugin 名嗎?
以及如何在 $Base = new \plugin\took\app\controller\Base; 時(shí) 給到config中:$this->bot = $this->request->get("bot","null"); 怎么給傳這個(gè)bot 參數(shù)過去?

878 2 0
2個(gè)回答

kspade

我如果用:域名/app/took/Base/plugin?bot=ssssssss
這樣就可以獲取到plugin 和 bot 參數(shù)

  • 暫無評(píng)論
walkor 打賞

按照你的需求,Config的構(gòu)造函數(shù)里直接寫死 $this->plugin = 'took'; 就好了

年代過于久遠(yuǎn),無法發(fā)表回答
??