我正在查看PHP,我看到了下面的代码
$tidy = new tidy;
$tidy->parseString($html, $config, 'utf8');
$tidy->cleanRepair();
// Output
echo $tidy;Tidy这里是一个对象。为什么不抛出一个Catchable fatal error: Object of class tidy could not be converted to string错误?
发布于 2016-01-21 11:25:15
我不太熟悉整洁,但我的猜测是,对象实现了神奇的方法__toString(),如下所述:http://php.net/manual/en/language.oop5.magic.php#object.tostring
https://stackoverflow.com/questions/34922448
复制相似问题