在调用类后不返回任何方法

时间:2018-05-04 13:58:20

标签: php class

我想这样做。我有一个我的类的实例,并且在我想要返回之后不使用该方法。我怎么能这样做?

我想做;

<?php 

class a {

    public function __construct(){
    }

    public function get(){
        return 'hello world';
    }

}

echo (new a());  // print hello world

?>

0 个答案:

没有答案
相关问题