Underscore method prefix

后端 未结 7 2038
挽巷
挽巷 2021-01-06 00:12

I\'ve been examining the code of CodeIgniter and CakePHP and I noticed that some of the methods in their classes are prefixed with an underscore _ or a double u

7条回答
  •  北海茫月
    2021-01-06 00:40

    I'm not familiar with CakePHP or CodeIgniter, but I think they should be regarded as protected or private for non-CakePHP classes. They are probably public as they can be called from other classes, making some kind of hack. Please note that __get, __construct and other magic methods (as noted above) exists in PHP.

提交回复
热议问题