当前位置:网站首页>How to use the container reflection method encapsulated by thinkphp5.1 in business code
How to use the container reflection method encapsulated by thinkphp5.1 in business code
2022-07-06 05:54:00 【Beiqiaosu】

invokeClass
usage : Namespace instantiation is not required ( Instantiated by reflection )
$obj = Container::getInstance()->invokeClass(InvokerTest::class);
var_dump($obj->invokerNews());die;
-----------------------------------------------------------------------
invokeMethod
usage : Pass in the class with namespace and the corresponding method , Call this method after instantiation
$methods = Container::getInstance()->invokeMethod(["app\common\service\InvokerTest", "invokerNews"]);
var_dump($methods);die;

-----------------------------------------------------------------------
invokeFunction
usage : You can execute custom functions and closures , Parameters are passed as an array
$functions = Container::getInstance()->invokeFunction(function ($name) {
return "hello {$name}";
}, ["beiqiaosu"]);
var_dump($functions);die;
$functions = Container::getInstance()->invokeFunction("procmsg", ["12312", "heillo"]);
var_dump($functions);die;
-----------------------------------------------------------------------
invoke
usage :invokeFunction and invokeMethod A combination
$invoke = Container::getInstance()->invoke(["app\common\service\InvokerTest", "invokerNews"]);
var_dump($invoke);die;
边栏推荐
- Construction of yolox based on paste framework
- Title 1093: character reverse order
- 29io stream, byte output stream continue write line feed
- Closure, decorator
- Station B Liu Erden linear regression pytoch
- H3C V7 switch configuration IRF
- Station B, Master Liu Er - back propagation
- Luogu [Beginner Level 4] array p1427 number game of small fish
- SequoiaDB湖仓一体分布式数据库2022.6月刊
- 网站进行服务器迁移前应做好哪些准备?
猜你喜欢

如何在业务代码中使用 ThinkPHP5.1 封装的容器内反射方法

网站进行服务器迁移前应做好哪些准备?

What impact will frequent job hopping have on your career?

Migrate Infones to stm32

c语言——冒泡排序
![[paper reading] nflowjs: synthetic negative data intensive anomaly detection based on robust learning](/img/9c/2753f68ecec3555aaca23800dada1e.png)
[paper reading] nflowjs: synthetic negative data intensive anomaly detection based on robust learning

continue和break的区别与用法

网络协议模型

The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower

【论文阅读】NFlowJS:基于鲁棒学习的合成负数据密集异常检测
随机推荐
Yygh-11-timing statistics
MIT6.s081-2020 Lab2 System Calls
B站刘二大人-Softmx分类器及MNIST实现-Lecture 9
Li Chuang EDA learning notes 12: common PCB board layout constraint principles
H3C防火墙RBM+VRRP 组网配置
Raised a kitten
PDK工藝庫安裝-CSMC
The usage and difference between strlen and sizeof
华为BFD的配置规范
实践分享:如何安全快速地从 Centos迁移到openEuler
CoDeSys note 2: set coil and reset coil
SequoiaDB湖仓一体分布式数据库2022.6月刊
Application Security Series 37: log injection
Title 1093: character reverse order
ArcGIS应用基础4 专题图的制作
How to download GB files from Google cloud hard disk
Huawei BFD configuration specification
H3C V7 switch configuration IRF
Zoom through the mouse wheel
【无标题】