目的
- 為了製作模板引擎印出View物件
紀錄
程式
class view
{
protected $__content = '';
public function __construct(string $viewPath)
{
#Code...
}
public function __toString() : string
{
$this->__content = '<div>test<div>';
return $this->__content;
}
}
$view = new view();
echo $view
結果
<div>test<div>