Skip to content

Instantly share code, notes, and snippets.

@suziewong
Created December 25, 2012 04:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save suziewong/4371647 to your computer and use it in GitHub Desktop.
Save suziewong/4371647 to your computer and use it in GitHub Desktop.
PHP面向对象中 _set() 与 _construct的作用?

_set() ——- 用于为属性设置值, _get() 获取属性的值

_construct ——- 在一个类中只能声明一个构造方法,只有在每次创建对象的时候回去调用一次构造方法,不能主动的调用这个方法,所以通常用它执行一些有用的初始化任务。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment