<?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;
}
}
示例代碼:
$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ù)過去?