__toString,
分享于 点击 42671 次 点评:63
__toString,
<?php
class TestClass
{
public $foo;
public function __construct($foo) {
$this->foo = $foo;
}
public function __toString() {
return $this->foo;
}
}
$class = new TestClass('Hello');
//直接输出对象
echo $class;
?>
Hello
相关文章
- 暂无相关文章
用户点评