php - codeigniter: private properties in controller -


Is it a good practice to use private properties in codeigniter controllers?

For example

  & lt ;? Php class X_controller controller {Private $ data; Function __construct () {root: controller (); $ This- & gt; Data = "xx"} function index () {// $ this- & gt; Use data somewhere? }}  

Anything can not directly use controllers by default, but Use HMVC if it is fixed in the future or expand other controllers (unless you, when, when and how), if you use personal, you can give some difficulties. (Unless you know it)

I use protected for myself, but it does not really make much difference to normal codeigner usage.


Comments