PHP 5.3的新增魔术方法 __invoke
网络整理 - 07-27
PHP5.3新增了一个叫做__invoke的魔术方法,这样在创建实例后,可以直接调用对象。class testClass
{
public function __invoke
{
print “hello world”;
}
}
$n = new testClass;
$n();
执行结果为:
hello world。
class testClass
{
public function __invoke
{
print “hello world”;
}
}
$n = new testClass;
$n();
执行结果为:
hello world。