Note: in Yaf, init is understood as _ construct () {code...} by default. Is there any difference between init and the following statements? {Code...} is one of the following Cainiao, hoping to have a good programming habit. I still hope to give some guidance on the basics. note: The init in Yaf is understood
_ Construct ()
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 ();}}
Is it different from the following?
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 ();}}
I hope to have a good programming habit when I'm a newbie. I hope I can give some advice if I have a poor foundation.