php tostring用法

<?php


        class a{
            private $a="123";
            private $b="456";
            public function __toString()
            {
                // TODO: Implement __toString() method.

    return $this->a.$this->b;
    }
    }


    $a  = new a();

    echo $a;

相关推荐