一、YII2使用当前控制器的方法
1、先在当前控制器定义方法
protected function getAllData($drug_name){
$data = [];
####
return $data;
}
2、在控制器中调用
public function actionIndex(){
$name = 'a';
$obj = $this->getAllData($name);
}
转载于:https://blog.51cto.com/hfreeze/1785770