1.依赖注入,将类以参数的形式传入方法中, 相当于在方法中 new Store();
namespace app\api\controller;
use model\ModelEntity as Store;
class Api{
//依赖注入 Store,相当于在方式中已 $store = new Store();
public function storeList(Store $store){
$list = $store->getList();
}
}
标签:依赖,tp,手册,store,阅读,new,Store From: https://www.cnblogs.com/qiuphp/p/17352690.html