注:Yaf 里的init 在下默认理解为__construct()
<code>class Order{ private $extend = ''; private $order = ''; public function init(){ parent::init(); $this->order = new Order(); $this->extend = new OrderEx(); } public function listAction(){ $this->order->public(); } public function makeAction(){ $this->extend->public(); } }</code>
与以下写法有什么不同吗?
<code>class Order{ private $extend = ''; private $order = ''; public function init(){ parent::init(); } public function listAction(){ $order = new Order(); $order->public(); } public function makeAction(){ $extend= new extend(); $extend->public(); } }</code>
在下小菜鸟一枚,希望有个良好的编程习惯,有些基础不踏实 还望指点