PHP7新特性--Closure::call() 2019-09-05T10:01:00 <?php //Closure::call() 现在有着更好的性能,简短干练的暂时绑定一个方法到对象上闭包并调用它。 // 声明一个class A class A { private $x = "1"; public function testEcho() { echo "!!!"; } } // 创建一个匿名函数 $getX = function () { $this->testEcho(); return $this->x; }; echo $getX->call(new A()); 当前页面是本站的「Baidu MIP」版。发表评论请点击:完整版 »