(转载)http://s.yanghao.org/program/viewdetail.php?i=184313
php的类中可以不定义成员变量,直接在构造方法中使用并赋值吗?
class block { function block() { $this->iconWidth = "23"; $this->iconHeight = "23"; $this->bgColor = "#5B7F93"; $this->fgColor = "#C4D3DB"; $this->oddColor = "#F5F5F5"; $this->evenColor = "#EFEFEF"; $this->highlightOn = "#DEE7EB"; $this->class = "odd"; $this->highlightOff = $this->oddColor; $this->theme = THEME; $this->pathImg = "../themes"; } ... }
这是我看到的一个类,感觉很奇怪,它也沒有父类。
PHP基础 8 次浏览 2011-10-10 17:47